align the horizontal field Manager

Hello

I need where I want my horizontalfieldmanager just above the horizontalfieldmanager another which is initilized as setStatus... (below the screen)...

use an optimization of resources, place the two hfms, use setStatus with optimization of resources.

Tags: BlackBerry Developers

Similar Questions

  • How to change the background color of the horizontal field Manager

    How can we tell the background color of the horizontal field Manager (hfm) hanger

    If we should extend and override in ppaint, I tried

    I got color of hfm in tag I added to this

    all give me idea

    Try this:

            HorizontalFieldManager manager = new HorizontalFieldManager()
            {
                public void paint(Graphics graphics)
                {
                    graphics.setBackgroundColor(0x000000FF);//blue
                    graphics.clear();
                    super.paint(graphics);
                }
            };
    

    Concerning

    Bika

  • Assign a spacing equal to the fields in the horizontal field Manager

    Hello

    I add a number of vertical field managers to a horizontal field Manager. Each manager of vertical field has a text with an image under. The text varies in width images in each vertical field Manager seem to have a different amount of space between them. Is there a way to remedy this situation? Joined a raw image in the way that message on the screen. How can I get the same amount of space between each area of the rectangle?

    Thank you

    Here's some code that I received from one of the sessions at the last DevCon.  Should be useful.  Might help explain customer managers too.

    /*
     * EqualSpaceToolbar.java
     *
     * Research In Motion Limited proprietary and confidential
     * Copyright Research In Motion Limited, 2009-2009
     */
    
    import net.rim.device.api.ui.*;
    
    public class EqualSpaceToolbar extends Manager {
    
        private static final int SYSTEM_STYLE_SHIFT = 32;
    
        public EqualSpaceToolbar() {
            this( 0 );
        }
    
        public EqualSpaceToolbar( long style ) {
            super( USE_ALL_WIDTH | style );
        }
    
        protected void sublayout( int width, int height ) {
            int numFields = getFieldCount();
            int maxHeight = 0;
    
            // There may be a few remaining pixels after dividing up the space
            // we must split up the space between the first and last buttons
            int fieldWidth = width / numFields;
            int firstFieldExtra = 0;
            int lastFieldExtra = 0;
    
            int unUsedWidth = width - fieldWidth * numFields;
            if( unUsedWidth > 0 ) {
                firstFieldExtra = unUsedWidth / 2;
                lastFieldExtra = unUsedWidth - firstFieldExtra;
            }
    
            int prevRightMargin = 0;
    
            // Layout the child fields, and calculate the max height
            for( int i = 0; i < numFields; i++ ) {
    
                int nextLeftMargin = 0;
                if( i < numFields - 1 ) {
                    Field nextField = getField( i );
                    nextLeftMargin = nextField.getMarginLeft();
                }
    
                Field currentField = getField( i );
                int leftMargin = i == 0 ? currentField.getMarginLeft() : Math.max( prevRightMargin, currentField.getMarginLeft() ) / 2;
                int rightMargin = i < numFields - 1 ? Math.max( nextLeftMargin, currentField.getMarginRight() ) / 2 : currentField.getMarginRight();
                int currentVerticalMargins = currentField.getMarginTop() + currentField.getMarginBottom();
                int currentHorizontalMargins = leftMargin + rightMargin;
    
                int widthForButton = fieldWidth;
                if( i == 0 ) {
                    widthForButton = fieldWidth + firstFieldExtra;
                } else if( i == numFields -1 ) {
                    widthForButton = fieldWidth + lastFieldExtra;
                }
                layoutChild( currentField, widthForButton - currentHorizontalMargins, height - currentVerticalMargins );
                maxHeight = Math.max( maxHeight, currentField.getHeight() + currentVerticalMargins );
    
                prevRightMargin = rightMargin;
                nextLeftMargin = 0;
            }
    
            // Now position the fields, respecting the Vertical style bits
            int usedWidth = 0;
            int y;
            prevRightMargin = 0;
            for( int i = 0; i < numFields; i++ ) {
    
                Field currentField = getField( i );
                int marginTop = currentField.getMarginTop();
                int marginBottom = currentField.getMarginBottom();
                int marginLeft = Math.max( currentField.getMarginLeft(), prevRightMargin );
                int marginRight = currentField.getMarginRight();
    
                switch( (int)( ( currentField.getStyle() & FIELD_VALIGN_MASK ) >> SYSTEM_STYLE_SHIFT ) ) {
                    case (int)( FIELD_BOTTOM >> SYSTEM_STYLE_SHIFT ):
                        y = maxHeight - currentField.getHeight() - currentField.getMarginBottom();
                        break;
                    case (int)( FIELD_VCENTER >> SYSTEM_STYLE_SHIFT ):
                        y = marginTop + ( maxHeight - marginTop - currentField.getHeight() - marginBottom ) >> 1;
                        break;
                    default:
                        y = marginTop;
                }
                setPositionChild( currentField, usedWidth + marginLeft, y );
                usedWidth += currentField.getWidth() + marginLeft;
                prevRightMargin = marginRight;
            }
            setExtent( width, maxHeight );
        }
    
    }
    
  • How to add the line of separation in the horizontal field Manager

    I want to get as

    name | Age | year

    all this in a horizontalfield Manager, how to do.

    I used the field separator, comes to the entire screen, such as

    name | Age | year

    |       |

    |       |

    |       |

    How do I solve this problem

    Thank you

    You can also do this by substituting your HorizontalFieldManager sublayout() method.

    As:

            h = new HorizontalFieldManager()
            {
                protected void sublayout( int maxWidth, int maxHeight )
                {
                    int width = Display.getWidth();
                    int height = 30; //height of the manager
    
                    super.sublayout( width, height);
                    setExtent( width, height);
                }
    
            };
    

    Concerning

    Bika

  • Align the HorizontalFieldManager field

    Hello

    I have a few problems right align my custombutton in a HorizontalFieldManager.

    I have a simple code like this:

    public class HeaderManager extends HorizontalFieldManager{
    
        public HeaderManager()    {        super(Manager.NO_HORIZONTAL_SCROLL| Manager.NO_VERTICAL_SCROLL|  Manager.USE_ALL_WIDTH | Manager.FIELD_RIGHT);
    
            this.setBackground(BackgroundFactory.createSolidBackground(Color.RED));
    
            ButtonImage mButtonRefresh =  new ButtonImage("refresh",DrawStyle.RIGHT);        mButtonRefresh.setMargin(6, 10,0 ,0);        this.add(mButtonRefresh);
    
        }
    
    }
    

    It's a pretty simple code, but it does not work!

    My Manager to take full width but my field stuck on the left.

    My custom button (ButtonImageGadget) simply extends the field.

    Y at - it a way to make it works or we have an absolute positioning with layoutChild?

    Thanks for your help

    Its a bug in blackberry jde, try the following:

    1. If you want to add only the unique field in this Manager, and then create the domain Vertical instead of horizontal area manager Manager.

    2. If you have two or fields, and all this must be right aligned, and then create a VerticalFieldManager (Manager.USE_ALL_WIDTH |) Manager.FIELD_RIGHT), create a horizontal field Manager add all the fields to this horizontal Manager, and addition of horizontal to vertical Manager Manager

    3. If you have several fields and these should be aligned differently, then please create a horizontal field Manager add fields to this Manager, you want to align to the left. create a verticalfieldmanager using field_right and the entire width. Create fields in this handler with Field.RIGHT or Field.HCENTER style according to your needs.

  • How to set horizontal scrolling to horizontal field Manager when fields are added using a loop for?

    The following code snippet contains a horizontal field Manager to which are added five buttons.

    1. I can't the value of horizontal scrolling to horizontal management Manager because of who I am not able to access the keys 4 and 5.

    2. usually, we put horizontal scrolling in the following way:

    container = new HorizontalFieldManager(USE_ALL_WIDTH|HORIZONTAL_SCROLL|HORIZONTAL_SCROLLBAR);
    

    3. so I also tried setting of horizontal scrolling in the following way

       container = new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL|Manager.HORIZONTAL_SCROLLBAR)
                {
    
                    protected void sublayout(int maxWidth, int maxHeight) {
    
                        Field field = null;
                        int x = 0;
                        int y = 0;
                        int maxFieldHeight = 0;
                        int maxFieldWidth = 0;
                        for (int i = 0; i < getFieldCount(); i++)
                        {
                            field = getField(i);
                            layoutChild(field, maxWidth, maxHeight);
                            setPositionChild(field, x/*width-field.getWidth()*/,y);
    
                            x+=field.getWidth();
    
                            maxFieldWidth = maxFieldWidth + field.getWidth();
                            System.out.println("field width"+field.getWidth());
                            System.out.println(" max field width"+maxFieldWidth);
    
                            if(i==0)
                            {
                                maxFieldHeight = field.getHeight(); // height set of the first button since all components have the same height
                            }
                        }
                        System.out.println("final max field width"+maxFieldWidth);
    
                        setExtent(maxFieldWidth, maxFieldHeight);
    
                    }
                };
    

    but it's not working.

    4 I found this property: (position) horizontalFieldManager.setHorizontalScroll; that contains the parameterioo where the post is supposed to be the new horizontal scroll position. I tried passing the coordinate x of horizontal field Manager, but it does not work. I should pass as a parameter position?

    HorizontalFieldManager container = new HorizontalFieldManager()
    {
        protected void sublayout(int maxWidth, int maxHeight)
        {
            Field field = null;
            int x = 0;
            int y = 0;
            int maxFieldHeight = 0;
            for (int i = 0; i < getFieldCount(); i++)
            {
                field = getField(i);
                layoutChild(field, maxWidth, maxHeight);
                setPositionChild(field, x,y);
                x+=field.getWidth();
                if(i==0)
                {
                    maxFieldHeight = field.getHeight(); // height set of the first button since all components have the same height
                }
            }
    
            setExtent(Display.getWidth(), maxFieldHeight);
    
        }
    };
    
    ButtonField button1 = new ButtonField("Button1");
    ButtonField button2 = new ButtonField("Button2");
    ButtonField button3 = new ButtonField("Button3");
    ButtonField button4 = new ButtonField("Button4");
    ButtonField button5 = new ButtonField("Button5");
    
    container.add(button1);
    container.add(button2);
    container.add(button3);
    container.add(button4);
    container.add(button5);
    
    add(container);
    

    Need your valuable comments and suggestions. Please help me.

    I think that there is a bug in the sublayout (your HorizontalFieldManager 0 mode.  Given that the code did what I think WHAT HFM will do anyway, I recommend that you try to do this with a standard HFM, using this style:

    Manager.HORIZONTAL_SCROLL | Manager.HORIZONTAL_SCROLLBAR

    Let us know how you go.

    When I have more time I'll explain the bug, but if you want to investigate something, be aware that the maximum size that you can use in setExtent are the values that are passed to sublayout.  Compare the width as you try to define in setExtent whose width is increased.

  • How to align the Hcenter fields in VFM?

    How to align the Hcenter fields in VFM? its giving problem

    solution on mine! years of posting for reference...

    what I did earlier.

    I wanted to have a manager of fixed size (maximum size) and put fields here, during an aliging then using stylebit it did not work. I used sublayout and fixed to what extent a perticular dimension

    resovled doing problem.

    It is not sufficient (or necessary) to if you want to use sublayout to have a fixed size, if you use the alignment, bcz setting hardcodedly properties, the other model overridden, so u must override the methods 'getPrefferedWidth & height', not the two held all the time, but according to the needs, if you want to:-alignment, you can try only method "width" and comparable to V-alignment. I included these methods and found that half of my UI related issues would have resolved more easily, if I tried this previously.

    Thank you best regards &.

  • Align the text field and a button.

    Hi all

    I use Oracle APEX 5.0.1.

    I tried to create a search page that contain a text field and a button.

    But I can't align the text field and button, so they can have the same top position.

    Could someone please help me solve this problem?

    APEX-ARE-Search.jpg

    Thank you and best regards,

    Troy.

    Hello.

    Have you tried to add a css attribute to the button? like: style = "top: 4px;

    Concerning

  • 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.

  • 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)

  • some fields shows don't not in horizontal field Manager

    Hello

    I try to have several lines with label, number and units. For example temperature, 17, F. When the application draws lines the label is visible, but the units are not. No idea why? Maybe it's pushing too far to the right, and they are off the screen? I use the Simulator for this.

    I tried to limit the size of the label field with no luck and I have also experimented with eliminating the label field, which causes the units to appear but then of course I still need labels. My code is below:

    Private HorizontalFieldManager generateMeasurementField (label As String, String unitLabel) {}
    Line HorizontalFieldManager = new HorizontalFieldManager();
    Field TextField = new TextField();
    field.setEditable (false);
    field.setLabel (label);
    UnitField TextField = new TextField();
    unitField.setText (unitLabel);
    unitField.setEditable (false);
    Row.Add (Field);
    Row.Add (unitField);
            
    next row;
    }

    And then I subsequently add each row to the Senior Manager.

    TextField is eager for width: it occupies the entire available width (do not leave anything for the rest of the fields). If you do not need to edit the text, use LabelField instead: they are economical and meet only as needed.

  • UI - Custom Paint in Horizontal Field Manager after completing the setting scrolling

    Hello

    I am able to do horizontal page scrolling when you add fields in horizontalFieldManger.

    But now I want to do a custom in horizontalFieldManager, paint using the page horizontal scrolling top given adjustment.

    Thank you

    It seems that you want to have background - repeat some almost text in your example. Then move it out of the subpaint and by the paintBackground-, you will not have to invoke any Super... here.

    Now when you say that a horizontal scrolling does not work, what exactly do you see? What do you see? Do you have enough focusable fields in your handler for scroll? Have HORIZONTAL_SCROLL style bit set?

  • effect of animation for horizontal field Manager

    Hello
    I have three willing fieldManagers horizontally in the content of

    average fieldmanager will change on click of a button

    is it possible to apply slide in French - sliding effect to these content?

    I don't want to do the new screen n again?

    Wrap the Middle Manager in a HorizontalFieldManager (HORIZONTAL_SCROLL). When you want to remove the old content and slide into the new, follow these steps:

    (1) adds the new content the HFM;

    (2) an animation slide to the left edge of the old content (probably 0) up to the left edge of the new (getLeft() returns). Use the method suggested by Peter;

    (3) once the animation finished, remove old content and setHorizontalScroll on the HFM wrapping to 0 (since the new content now starts it).

  • Add the horizontal field at the bottom of the screen

    what I've done

    in Builder screeen

    Super (Manager.USE_ALL_HEIGHT);

    HorizontalFieldManager hf = new HorizontalFieldManager (Manager.BOTTOMMOST);

    Add (HF);

    but horizontalfield does not go to the bottom of the screen

    used setstatus solved the problem

    instead of add (hf) used

    setStatus (hf);

  • Align the fields of HorizontalFieldManager

    vfm = new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH);
    hfm = new HorizontalFieldManager();
    Date now = new Date();
    SimpleDateFormat sdf = (SimpleDateFormat) DateFormat.getInstance(DateFormat.TIME_LONG);
    String time = sdf.format(now);
    hfm.add(new LabelField(time));
    labelField1 = new LabelField("1", LabelField.FIELD_HCENTER);
    labelField2 = new LabelField("2", LabelField.FIELD_RIGHT);
    vfm.add(labelField1);
    vfm.add(labelField2);vfm.setBackground(BackgroundFactory.createSolidBackground(Color.RED));
    hfm.add(vfm);
    add(hfm);
    hfm.setBackground(BackgroundFactory.createSolidBackground(Color.GREEN));
    

    Please take a look at this code. I expect to do the following: add time to the left of the horizontal field Manager, and then add a field in the center of it and in the right part. The first two tasks succeeded. But what is the problem with the third label, i.e. with "2"? Why would she be placed in the next line?

    Please tell me what I'm doing wrong...

    hfm = new HorizontalFieldManager(USE_ALL_WIDTH)
            {
                protected void sublayout(int maxWidth, int maxHeight)
                {
                    super.sublayout(maxWidth, maxHeight);
                    setPositionChild(this.getField(0),0,0);
                    setPositionChild(this.getField(1), (this.getWidth() - (labelField1.getWidth()))/2, 0);
                    setPositionChild(this.getField(2), (this.getWidth() - labelField2.getWidth()), 0);
                }
            };
            Date now = new Date();
            SimpleDateFormat sdf = (SimpleDateFormat) DateFormat.getInstance(DateFormat.TIME_LONG);
            String time = sdf.format(now);
            LabelField timeLabelField = new LabelField(time);
            hfm.add(timeLabelField);
            labelField1 = new LabelField("1", LabelField.FIELD_HCENTER);
            labelField2 = new LabelField("2", LabelField.FIELD_RIGHT);
            hfm.add(labelField1);
            hfm.add(labelField2);
            hfm.setBackground(BackgroundFactory.createSolidBackground(Color.RED));
            add(hfm);
            timeLabelField.setBackground(BackgroundFactory.createSolidBackground(Color.GREEN));
    

    Use this code, you will get the desired result.

Maybe you are looking for

  • What version of the PCI Express x 16, it's my motherboard has

    I am running: Pavilion - p6320y -AMD Phenom II X 4 820 -8 GB RAM -SATA HARD DRIVE 1 TB (7200 RPM) -Motherboard model: Violet6-GL8E Question: What version of the PCI Express x 16 is the slot on this motherboard: 1.x, 2.0 or 2.1? Can't get this informa

  • Microsoft Web impression

    Since the update to Vista 2 has been installed 2 days ago, I'm not able to connect to my web sites with Expression Web.  The sign in pop-up does not appear and I can't have my list of files to modify.

  • T410. Possible to update the graphics (Nvidia 3100 m)?

    Have a T410 (2522) with an Nvidia graphics card. I would buy another card best as I do some CAD work on my laptop. I have not found a clear answer to this, some information says that the 3100 m from Nvidia is switchable, other information says that T

  • How can I update an unsuccessful attempt to update nVidia?

    Original title: nVidia How can I update an unsuccessful attempt to update nVidia?

  • HP Photosmart d110: drivers for printers, I have no

    I seem to have a different problem than most. My printer works very well and has the current driver. Unfortunately, I have also a dozen drivers installed on my computer for printers I don't own, and never have. I can manually uninstall all drivers an