problem with the vertical field Manager

Hello

My application has a screen. On this, I add a Senior Manager vertical field. I add new labelfields dynamically to this vertical field Manager.  When I give the text in the constuctor of the etiquette field, each of them is the fine display. But when I tried to draw the text to the painting, it does not appear.

Here is my code...

vfm = new VerticalFieldManager(VERTICAL_SCROLL | FOCUSABLE);
        for (int i = 0; i < 4; i++) {
            index = i;
            LabelField labelField = new LabelField() {
                protected void paint(Graphics graphics) {
                    // TODO Auto-generated method stub
//                  super.paint(graphics);
                    graphics.setColor(Color.BLACK);
                    graphics.drawText(displayString[index], 0, 0);
                }
            };
            vfm.add(labelField);
        }
        add(vfm);

Please help me find a solution.

First of all, stop saying that it is VerticalFieldManager who has done something bad for you. It has nothing to do with it.

You use the index in your LabelField painting method. Use paint value is the current value of the index at the time of the painting. Painting happens way after you have created all your LabelFields, when the index stopped to change and has the last value of the loop variable (in your case, it's 3).

This, as well as LabelFields width zero (that you seem to have supported) so are the problems of your original code. Store the value of i in your LabelField somehow if you insist on using the table values. If only check out you them once and do not change them, consider creating your LabelFields with the text from this displayString table.

Even better: as you do not use the LabelField paint, why not create a custom field received a text and paint your smileys and all? Of course, you have to implement available as well, but it's useful even when your smileys will take a different width than the corresponding symbols.

To summarize: your current approach is bad. Take a step back, work on the design, and then implement.

Tags: BlackBerry Developers

Similar Questions

  • problem with the vertical field Manager / vertical scroll

    Hello

    I've set up a screen which makes use of a vertical field Manager by using the following code:

    class Main_Menu extends MainScreen {
    
        public class FixedWidthButtonField extends ButtonField{
            private int width;
    
            FixedWidthButtonField( String label, int Width){
                super( label, Manager.FIELD_HCENTER);
                width = Width;
            }
    
            public int getPreferredWidth(){
                return width;
            }
        }
    
        public Main_Menu() {
            setTitle(new LabelField ("Main Menu Screen", Field.FIELD_HCENTER));
            setStatus(new LabelField ("Breakout Game ©", Field.FIELD_HCENTER));
            VerticalFieldManager backgroundManager = new VerticalFieldManager(Manager.USE_ALL_WIDTH|Manager.USE_ALL_HEIGHT|Manager.NO_VERTICAL_SCROLL)
            {
                protected void paint(Graphics graphics) {
                    graphics.setBackgroundColor(0x0000A2E8);
                    graphics.clear();
                    super.paint(graphics);
                }
            };
    
            FixedWidthButtonField playButton;
            FixedWidthButtonField instructionsButton;
            FixedWidthButtonField topScoresButton;
            FixedWidthButtonField quitButton;
    
            playButton = new FixedWidthButtonField("Play",(Display.getWidth() / 2) - 80);
            instructionsButton = new FixedWidthButtonField("Instructions",(Display.getWidth() / 2) - 80);
            topScoresButton = new FixedWidthButtonField("Top Scores",(Display.getWidth() / 2) - 80);
            quitButton = new FixedWidthButtonField("Quit",(Display.getWidth() / 2) - 80) {
                protected boolean navigationClick(int status, int time)
                {
                    getScreen().close();
                    return true;
                }
            };      
    
            playButton.setMargin(40,0,0,0);
            backgroundManager.add(playButton);
            instructionsButton.setMargin(10,0,0,0);
            backgroundManager.add(instructionsButton);
            topScoresButton.setMargin(10,0,0,0);
            backgroundManager.add(topScoresButton);
            quitButton.setMargin(10,0,0,0);
            backgroundManager.add(quitButton);
    
            add(backgroundManager);
        }
    }
    

    The problem I have is that the screen scrolled down to see the empty space after the final touches, and I can't seem to overcome this problem and prevent additional scrolling. I just want the ability to scroll the 4 buttons and have a blue background on the entire screen.

    Thank you

    Just quickly, so watch migth have wrong, but if you have a good overview of this very useful article:

    http://supportforums.BlackBerry.com/T5/Java-development/MainScreen-explained/Ta-p/606644

    I think you will find that you need to add the following at the beginning of your screen manufacturer:

    Super (NO_VERTICAL_SCROLL)

  • problems with the adobe application manager

    I have problems with the adobe Application Manager.

    Please see the links below.

    Hope this will help you.

    Kind regards

    Hervé Khare

  • Need help with this Vertical field Manager? It scrolls to the low n!

    I created a vertical field Manager

    public class BGManager extends VerticalFieldManager{
        public BGManager() {
            super(VerticalFieldManager.USE_ALL_WIDTH|USE_ALL_HEIGHT);
        }
        public void paint(Graphics graphics)
        {
            graphics.setBackgroundColor(Color.BLACK);
            graphics.clear();
            super.paint(graphics);
        }
    
    }
    

    I added to my screen, then I added fields in addition to this.

    It works fine, but the Manager starts to scroll down when the focus is on the last field and I'm trying to scroll down.

    He does not stop to the last topic.

    How can I fix?

    Take a look at this thread. It addresses exactly your problem with solution:

    http://supportforums.BlackBerry.com/T5/Java-development/VerticalFieldManager-with-fixed-size-scroll-...

  • problem with the windows Task Manager.

    Hello.i uses windows 7 64 bit and I have a problem with my windows task manager.i am still able to use the windows task manager but when it appears, the tab all lack .it s display only a program this running.i hope you can help solve this problem.thank you.

    To regain the tabs and information, double-click on the outside edge of the window.

  • Problem with the plugin Update Manager

    I'm having a problem with the update on my VC Server Manager (2.5 build 104215).  Update Manager is not downloaded updates.  In VC when I go to Plugins it shows that Updae Manager is installed and enabled.  If I remove the check mark for Enabled & then turn it back on, I get a message - "the server could not interpret the customer's request" - but the checkbox reappears.  I also have this message when I run VC on the server, but not from my PC.

    If I right click on the download VMware Update Manager update scheduled task and select Properties, I get a message - "the plugin for this task has not been saved.   All VMware services are started.  The Update Manager

    Update Manager is built 1.0.0.63972 and the VI client on the server is 104215

    Thanks for any help.

    He is now in place and running as planned?

  • Problem with the Auto-Snapshot manager after domain change

    Hello

    I have a client with a FailoverCluster Hyper-v and CSV.

    They recently changed their internal domain name, and since then, they have problems connecting to the PS Group in the Auto-snapshot Manager.

    I get an error saying:

    An error occurred processing action: Discovery.
    An exception was thrown by the target of a call.

    I hope someone can point me in the right direction :)

    Anders

    I suspect that your iSCSI initiator has problems connecting to volumes - and your problem is, in fact, isolated ASM / me.  Check the RUNAS account used on the services of the DSO to ensure that they use the appropriate domain credentials.

  • problem with the custom field. Please help!

    Hi, I'm basiceditfield using code below, to draw the border and background in 4.5 jde. I hv tried a lot of things to set his height.but his does not work for all value.even I put height 100, it does not display the bottom line of the field

    Basic BasicEditField = new BasicEditField("","",15,1) {}

    g.setColor (14315734);
    g.setColor (Color.PERU);
    g.fillRoundRect (0,0,30,30,0,0);
                  
    g.setColor (Color.BLACK);
    g.setFont (Helper.getFont(6,"",false));
    g.drawText ("", 3, 3);
    g.setColor (Color.MAGENTA);
    g.drawRoundRect (20,30, 0, 0, 0, 0);

    Super.Paint (g);
    }
    };

    Mr.Peter,

    I tried already and surfing on the internet, my problem is something different and so I started a new thread, because I couldn't find the solution. Tried several codes that are on the forum, but with the same result, that's y I posted my code here.

  • Problems with the NVARCHAR2 fields

    I use ROracle to query a database with a field of type NVARCHAR2. When I access the database directly or through RJDBC, I have no problem with that. However, if I do something like

    res = dbSendQuery(conn, qry)
    dbColumnInfo(res)
    
    
    

    He told me that the 'type' is VARCHAR2. So when I use fetch (res), it's not back up the data correctly (it gives? instead). Is there anyway so that it can detect the NVARCHAR fields, properly or even manually it say when a field must be NVARCHAR?

    Edit: Try explicitly casting in my query (e.g. qry = "select cast (textfield you mvarchar2 (100)) from myTable ') and which did not help.

    Edit2: It turns out that this problem persists even with fields containing unicode VARCHAR2.

    Post edited by: 88dc10cb-b8b0-44c7-acff-5d6dc55a69dc

    I had to exportNLS_LANG=AMERICAN_AMERICA.AL32UTF8 and then load the package

    Sys.setenv(NLS_LANG = 'AMERICAN_AMERICA. AL32UTF8")

    library(ROracle)

  • Problem with the form field.

    well don't know what to do with it. First of all, I removed all the contacts on the site of BC. So, right now, there is no customer in the CRM.

    But when I go to create a web form under the TITLE instead of having simply Mr., Mrs., etc... I have a complete list of email addresses. I can clean manually if I paste the code of the form on the page but don't want to do that every time. Any ideas as to where this source is shooting?

    webform sample.jpg

    Go to the CRM, go to a client or to go make one.

    Click on the square next to the title field - this allows you to create/edit and delete entries.

    In terms of how it happened - when you have imported you imported the names in the wrong column and was in the title column.

  • I have a problem with the Caption field

    When I type the text that is wider than the field Caption, I can see it is no longer in the text field, he dressed not to the next line.  I can still take my arrow to the right and hit it so that I can see.  What I am doing wrong? See the example below.

    LR3 is running on my MAC using OS X 10.6.5.  The LR version is 3.3.

    Any suggestions will be greatly appreciated.  Thanks ADubin

    Screen shot.jpg

    The key to solving it is to solve why the display window is rendered oddly.  I would like to look 2D, multiple monitor configuration graphics implementation and so on.  Make sure you look at the configuration of the monitor, as well.  Try resetting the monitor settings (horizontal, vertical tweaking, for example.)  And app like Lr juice thas to play within the operating system, so there is a kind of poor ongoing communication.

  • Problem with the digital field model

    Hello!

    This problem is driving me crazy!...

    I placed a numeric field and used the following model:

    NUM {zzz zzz zzz, zz9.99}

    This field must view and accept with 2 decimal places and in European format floating point numbers.

    The locale by default for this form are the Portuguese (Brazil).

    So... If I type something like 99999, the field correctly 99.999,00.

    Now, if I type 99999.00, once again the field correctly contains 99.999,00.

    However, if I type 99999,00 (with a comma instead of a period, what I need) field contains 0.00.

    Please, thank you very much for all the ideas!

    Marcos

    The result you get is correct, because the boss lets only a time separate decimals.

    Try the following change:

    NUM {zzzzzzzzzzz9, 99}. NUM {zzzzzzzzzzz9.99}

    and this view model:

    NUM {zzz.zzz.zzz.zz9, 99}

  • OfficeJet 6600/problem with the vertical line that appears both scanned and copied items

    There is a vertical line that follows the entire length of a page when I scan or copy.  Have cleaned the glass, it is not the effect.  Help

    Hi gljatlaw,

    I see that you are having problems of quality of scan.  I'll take a look at the document below.

    Scan quality

    Let me know how it goes.

  • OPA to interview for Rightnow - problem with the mapped fields

    Hi Experts

    We strive to integrate an interview of takeover bid for an anonymous user in Rightnow.

    At the end of the interview, a contact and an incident of child will be created in Rightnow.

    The integration works as expected.

    At the end of the interview, we would like to display the number of incidental reference to the user.

    However, the incident reference number of Rightnow field is not available in the list of fields that are mapped to the incident entity fields in the OPA.

    Another field of incident as a subject, category etc. are displayed and available to me all laid out, but not the reference number.

    While using this interview for the customer portal user Rightnow, mapping setting is different, and in this case the number of incidents of reference is allowed to be mapped.

    This similar to example modules design student benefits.

    But we need this feature for the anonymous user also.

    Help, please.

    Thank you

    Swati

    Hi Swati,

    Load after submit only is currently supported for the global object - contact in your case.

    If when the Incident is created, you can some how get RightNow to copy a custom field to the Contact reference number (for example lastCreatedRefNum or similar), then you could load from there in touch and then display it to the user.

    Davin.

  • I need to download Adobe Photoshop CC 2014 to fix a problem with the CC extensions Manager.

    Where is a link to download a previous version.  Due to the update of Windows 10, my PC was wiped out and I had to reinstall all the programs so PS CC 2014 was never installed on this laptop.

    I had the same problem. Here you can download 2014:

    Direct download links of Adobe CC 2014: 2014 creative cloud release | ProDesignTools

Maybe you are looking for