EyelidFieldManager with the combination of RichList but RichList is not displayed correctly

Hi all

I'm putting a RichList inside an EyelidFieldManager, but for some reason, RichList do not appear correctly. I use 6.0 SDK and Eclipse. To illustrate the problem, I created a hybrid project of EyelidFieldManagerDemo an example of RichList quick reference guide. I created a new VerticalFieldManager. Then I'm building RichList inside VerticalFieldManager. After that, I added VerticalFieldManager to the absolute position in EyelidFieldManager. As a result, RichList does not appear, but screen shows a thin line. Screenshot of the app is attached, and the code is as follows:

public final class EyelidFieldDemo extends UiApplication{    public static void main(String[] args)    {        UiApplication app = new EyelidFieldDemo();        app.enterEventDispatcher();    }

    public EyelidFieldDemo()    {        pushScreen(new EyelidFieldDemoScreen());    }

    public final class EyelidFieldDemoScreen extends MainScreen    {        private EyelidFieldManager _eyelidFieldManager;        /**         * Creates a new EyelidFieldDemoScreen object         */        public EyelidFieldDemoScreen()        {            super(NO_VERTICAL_SCROLL);  

            _eyelidFieldManager = new EyelidFieldManager();

            // Change the display time from the default 1.2s            _eyelidFieldManager.setEyelidDisplayTime(2000);

            // Build Rich List and add it to VerticalFieldManager         VerticalFieldManager vfm = new VerticalFieldManager(USE_ALL_HEIGHT | USE_ALL_WIDTH);          vfm.add(new LabelField("Rich List Of BlackBerry Devices Below"));            RichList list = new RichList(vfm, true, 2, 1);            Bitmap bitmap1 = Bitmap.getBitmapResource("9500.png");            Bitmap bitmap2 = Bitmap.getBitmapResource("9000.png");            list.add(new Object[] {bitmap1, "Device 1", "BlackBerry Smartphone 9500", "Description of Device 1."});            list.add(new Object[] {bitmap2, "Device 2", "BlackBerry Smartphome 9000", "Description of Device 2."});            _eyelidFieldManager.add(vfm, 0, 0);

            // Create Toolbar and add it to the bottom of eyelid            ToolbarManager toolbarMan = new ToolbarManager();            Image img = getImage("home.png");            StringProvider title = new StringProvider("Home");            ToolbarButtonField toolbarButton = new ToolbarButtonField(img, title);            toolbarMan.add(toolbarButton);            img = getImage("music.png");          title = new StringProvider("Music");          toolbarButton = new ToolbarButtonField(img, title);           toolbarMan.add(toolbarButton);            _eyelidFieldManager.addBottom(toolbarMan);

            add(_eyelidFieldManager);

            // Disable virtual keyboard so it doesn't obscure bottom eyelid            VirtualKeyboard keyboard = getVirtualKeyboard();            if( keyboard != null )            {                keyboard.setVisibility(VirtualKeyboard.IGNORE);            }        }

        /**         * @see MainScreen#onSavePrompt()         */        public boolean onSavePrompt()        {            // Suppress the save dialog            return true;        }    }

    private static EncodedImage getEncodedImage(String name) {       return EncodedImage.getEncodedImageResource(name);    }

  private static Image getImage(String name) {      return ImageFactory.createImage(getEncodedImage(name));   }}

I'll play with this combination of fields. Will post some results more than little time, and I am looking forward to any suggestions and ideas. Thank you very much!

Figured this out extending from VerticalFieldManager and substituting sublayout (int maxWidth, maxHeight int)

Looks like I have 'expand' manually VerticalFieldManager to get RichText will display correctly.

Here is the screenshot of n work code of the result screen:

public final class EyelidFieldDemo extends UiApplication
{
    public static void main(String[] args)
    {
        UiApplication app = new EyelidFieldDemo();
        app.enterEventDispatcher();
    }

    public EyelidFieldDemo()
    {
        pushScreen(new EyelidFieldDemoScreen());
    }

    public final class EyelidFieldDemoScreen extends MainScreen
    {
        private EyelidFieldManager _eyelidFieldManager;
        /**
         * Creates a new EyelidFieldDemoScreen object
         */
        public EyelidFieldDemoScreen()
        {
            super(NO_VERTICAL_SCROLL);  

            _eyelidFieldManager = new EyelidFieldManager();

            // Change the display time from the default 1.2s
            _eyelidFieldManager.setEyelidDisplayTime(2000);

            // Build Rich List and add it to VerticalFieldManager
            MyRichListWrapper wrapper = new MyRichListWrapper();
            wrapper.add(new LabelField("Rich List Of BlackBerry Devices Below"));
            RichList list = new RichList(wrapper, true, 2, 1);
            Bitmap bitmap1 = Bitmap.getBitmapResource("9500.png");
            Bitmap bitmap2 = Bitmap.getBitmapResource("9000.png");
            list.add(new Object[] {bitmap1, "Device 1", "BlackBerry Smartphone 9500", "Description of Device 1."});
            list.add(new Object[] {bitmap2, "Device 2", "BlackBerry Smartphome 9000", "Description of Device 2."});
            list.add(new Object[] {bitmap1, "Device 1", "BlackBerry Smartphone 9500", "Description of Device 1."});
            list.add(new Object[] {bitmap2, "Device 2", "BlackBerry Smartphome 9000", "Description of Device 2."});
            list.add(new Object[] {bitmap1, "Device 1", "BlackBerry Smartphone 9500", "Description of Device 1."});
            list.add(new Object[] {bitmap2, "Device 2", "BlackBerry Smartphome 9000", "Description of Device 2."});
            list.add(new Object[] {bitmap1, "Device 1", "BlackBerry Smartphone 9500", "Description of Device 1."});
            list.add(new Object[] {bitmap2, "Device 2", "BlackBerry Smartphome 9000", "Description of Device 2."});
            list.add(new Object[] {bitmap1, "Device 1", "BlackBerry Smartphone 9500", "Description of Device 1."});
            list.add(new Object[] {bitmap2, "Device 2", "BlackBerry Smartphome 9000", "Description of Device 2."});
            list.add(new Object[] {bitmap1, "Device 1", "BlackBerry Smartphone 9500", "Description of Device 1."});
            list.add(new Object[] {bitmap2, "Device 2", "BlackBerry Smartphome 9000", "Description of Device 2."});
            list.add(new Object[] {bitmap1, "Device 1", "BlackBerry Smartphone 9500", "Description of Device 1."});
            list.add(new Object[] {bitmap2, "Device 2", "BlackBerry Smartphome 9000", "Description of Device 2."});
            list.add(new Object[] {bitmap1, "Device 1", "BlackBerry Smartphone 9500", "Description of Device 1."});
            list.add(new Object[] {bitmap2, "Device 2", "BlackBerry Smartphome 9000", "Description of Device 2."});
            _eyelidFieldManager.add(wrapper, 0, 0);

            // Create Toolbar and add it to the bottom of eyelid
            ToolbarManager toolbarMan = new ToolbarManager();
            Image img = getImage("home.png");
            StringProvider title = new StringProvider("Home");
            ToolbarButtonField toolbarButton = new ToolbarButtonField(img, title);
            toolbarMan.add(toolbarButton);
            img = getImage("music.png");
            title = new StringProvider("Music");
            toolbarButton = new ToolbarButtonField(img, title);
            toolbarMan.add(toolbarButton);
            _eyelidFieldManager.addBottom(toolbarMan);

            add(_eyelidFieldManager);

            // Disable virtual keyboard so it doesn't obscure bottom eyelid
            VirtualKeyboard keyboard = getVirtualKeyboard();
            if( keyboard != null )
            {
                keyboard.setVisibility(VirtualKeyboard.IGNORE);
            }
        }

        /**
         * @see MainScreen#onSavePrompt()
         */
        public boolean onSavePrompt()
        {
            // Suppress the save dialog
            return true;
        }
    }

    public class MyRichListWrapper extends VerticalFieldManager {

        public MyRichListWrapper () {
            super();
        }

        protected void sublayout(int maxWidth, int maxHeight) {
            super.sublayout(Display.getWidth(), Display.getHeight());
        }
    }

    private static EncodedImage getEncodedImage(String name) {
        return EncodedImage.getEncodedImageResource(name);
    }

    private static Image getImage(String name) {
        return ImageFactory.createImage(getEncodedImage(name));
    }
}

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for

  • FPGA Express PID vs Custom PID behaves differently? Whats is wrong

    Hi all I try to use labview FPGA Express VI in my application with cRIO 9022. I write a custom PID and compare the result with the FPGA palette express PID. It seems that the integral action on the express PID is too large. I am using PID as a simple

  • Changing result data Access to SQL Server database

    For many years, we have worked with the Access databases.Now, we started with SQL-Server.We only have a UutResultTable and a StepResultTable(because we have already started with TestStand 1.02). We have worked with integers as Primarykey (UutResultId

  • As a second router WRT54G

    Hello In my home network, I have two routers connected LAN - LAN mode. My main router (not a Linksys router) is connected to the ISP by modem and my secondary router, which is a Linksys wrt54g, connected to the main router with wired connection. I fo

  • 100% CPU usage without a lot of programs running windows 7

    Hi all I have a WIndows 7 Home Premium 32 bit OS on a HP probook 4320 s (processor Intel i3, 3 GB of RAM). I have a problem that even if I have no major program (basic prograps such as winamp, freecell, 2-3 tabs in firefox/chrome, McAfee AV), to the

  • I left my laptop in the car overnight, and it froze. (literally) It lights up. What should I do?

    I left my laptop (HP TouchSmart tx2) in the car during the night and it froze, literally. It lights (or even try to). He has been inside, in my office for a little more than an hour now. I'll let you rest more at room temperature. But if she still wo