Put 2 buttons side by side

Hello

I would like to put 2 buttons side by side on the same line in my GUI.

I tried to do the following, but it didn't work:

m_Button1 = new ButtonField(  "Back", FOCUSABLE | DrawStyle.ELLIPSIS |
                              ButtonField.CONSUME_CLICK |
                              FIELD_RIGHT);
m_Button1.setChangeListener(this);

m_Button2 = new ButtonField(  "Next", FOCUSABLE | DrawStyle.ELLIPSIS |
                              ButtonField.CONSUME_CLICK |
                              FIELD_LEFT);
m_Button2.setChangeListener(this);

HorizontalFieldManager mgrHrz = new HorizontalFieldManager();
VerticalFieldManager mgrVertA = new VerticalFieldManager()
                   {
                        public int getPreferredWidth() {
                            return Display.getWidth() / 2;
                   }
                        };
VerticalFieldManager mgrVertB = new VerticalFieldManager()
                   {
                        public int getPreferredWidth() {
                            return Display.getWidth() / 2;
                        }
                   };
mgrVertA.add(m_Button1);
mgrVertB.add(m_Button2);
mgrHrz.add(mgrVertA);
mgrHrz.add(mgrVertB);
add(mgrHrz);

Anyone know what I am doing wrong?

THX.

robybd wrote:

Hello

I would like to put 2 buttons side by side on the same line in my GUI.

I tried to do the following, but it didn't work:

Does anyone know what i am doing wrong?

Thx.

getPreferredWidth() do not get used the way you'd expect it.  You can override the sublayout() of these VFMs and USE_ALL_WIDTH.  Like this:

... = new VerticalFieldManager(USE_ALL_WIDTH) {
    protected void sublayout(int w, int h) {
        super.sublayout(Math.min(w, Display.getWidth() / 2), h);
    }
};

It should work better - try it!

Tags: BlackBerry Developers

Similar Questions

  • Put two ObjectChoiceField side by side

    Hello

    I tried to put both components in a HorizontalFieldManager ObjectChoiceField, but I can't view both on the same line, it seems that the other is pushed off the screen to the right.

    I tried with Manager.NO_HORIZONTAL_SCROLL nothing works.

    Can anyone please help me;

    Thank you very much

    You can limit the width of one of them. These two talk on this subject, but for the different types of fields:

    http://supportforums.BlackBerry.com/T5/Java-development/can-t-put-BasicEditField-and-button-side-by-...

    http://supportforums.BlackBerry.com/T5/Java-development/please-help-with-trying-to-put-a-BasicEditFi...

    But if you are sure that they will hold next, you can set one on the left with the style

    Field.FIELD_LEFT and I think he'll try to stay as close to the left as it can.  Give it a try.

  • Does anyone know how to turn off this setting when your phone is at a certain angle turns on without you pressing the button side feed or House? Please if you know tell me!

    Does anyone know how to turn off this setting when your phone is at a certain angle turns on without you pressing the button side feed or House? Please if you know tell me!

    Settings > display and brightness > raise to Wake

  • How to put the button on the same line

    I am having some problems with the buttons. I have the main screen with a verticalmanagerfield parent, who has two sons a richtextfield and an editfield (these two are the same on both of the gpsdemo)

    I want to put 3 buttons under the sons of two field and these 3 buttons that we're going to be son of verticalmanagerfield, but I can't put them on the same line

    I'll show you two pictures what I mean

    first image: I see now

    second image: what I want

                HorizontalFieldManager hfm = new HorizontalFieldManager()
                {
                    protected void sublayout(int width, int height)
                    {
                        Field field;
                        int numberOfFields = getFieldCount();
                        int x = 0;
                        int y = 0;
                        width=250;
                        height=50;
    
                        for (int i = 0;i < numberOfFields;i++)
                        {
                            field = getField(i); //get the field
                            setPositionChild(field,x,y); //set the position for the field
                            layoutChild(field, width, height); //lay out the field
                            x += 120;
                        }
                        setExtent(width, height);
                    }
                };
    
                 hfm.add(new ButtonField("Button 1"));
                 hfm.add(new ButtonField("Button 2"));
    
  • How to put a button * inside * a trigger

    Hi people.

    I was directed to a good tutorial on how to put a button inside a target in a composition, but for some reason that I am not able to do the same thing when I try to put a button inside a trigger.

    I want to do is to have the icon of the trigger to change a bit (just get bigger) when you ride on it.   But I'm having a hell of a time.   Anyone know a work around?

    Thank you!

    No workaround but functionaloty normal:

    1. Select the trigger.

    2. open the States Panel.

    3, select 'Normal' in the States Panel.

    4. click on the word "fill" in the control strip above.

    5. a dialog box will open. Here, select an image to fill the trigger.

    6. click on other States in the States Panel and complete relaxation with a different version of your image.

  • Hi, I'm rookiee and I just started with the first steps of creating a Web site. the katies-coffee-building file is on my desk and uplouded in the library. That has worked well. Now I'm putting the button in Photo Shop (banner), I have pull down on file/pl

    Message "Hi, I'm rookiee and I just started with the first steps of creating a Web site. the katies-coffee-building file is on my desk and uplouded in the library. That has worked well. Now, I'm putting the button in Photo Shop (banner) in. I pull down on the file Photo Shop button instead and try to select the Banner.psd file. Unfortunately all of the (active) folder is not accessible to all. One is not visibel. Please - need some help here. Thank you.

    @Ach ja, meine Muttersprache ist Deutsch

    You must use the file > Place Photoshop button (Cmd / Ctrl + B).

  • put the button (and pop-up) to forward to the reversal

    I use button symbols to create pop ups on turnover (by pasting the box pop into their rollover State)

    However I need a way to put the buttons in the front when I rollover them because the pop up overlapping the other buttons.

    Irealise this question has been asked before, but I am very new to as3 and I find it difficult to adapt responses to my code.

    I am very grateful for any help

    Ben

    var buttons: Array = [btn1, btn2];

    function moveFront(event:MouseEvent):void {}

    go to the code before

    }

    for (var i: uint = 0; i < buttons.length; i ++) {}

    buttons [i] .addEventListener (MouseEvent.ROLL_OVER, moveFront);

    }

    :

    var buttons: Array = [btn1, btn2];

    function moveFront(event:MouseEvent):void {}

    event.currentTarget.parent.addChild (event.currentTarget);

    }

    for (var i: uint = 0; i

    buttons [i] .addEventListener (MouseEvent.ROLL_OVER, moveFront);

    }

  • AS3 putting the buttons inside the Movie Clip

    I'm practicing AS3 (after years of AS2) and can't have a button inside of a clip speaks to another clip on the main timeline. Here is the code:

    OneButton.addEventListener (MouseEvent.CLICK, OneButtonClicked);

    function OneButtonClicked(event:MouseEvent):void

    {

    MovieTarget.gotoAndStop (1);

    MovieDescription.gotoAndStop ("One");

    }

    TwoButton.addEventListener (MouseEvent.CLICK, TwoButtonClicked);

    function TwoButtonClicked(event:MouseEvent):void

    {

    MovieTarget.gotoAndStop (2);

    MovieDescription.gotoAndStop ("Two");

    }

    The code above works, but if I put OneButton and channels within a clip, I know can target the MovieTarget and MovieDescription. The reason that I want to put OneButton and strings inside it's own MC is so I can dim each hit after top by switching the playhead within this MC help. ? Thank you!

    Start from the beginning

    Press f8 and choose movieClip, then draw your button movie untoggled call then create another movie and create your button toggled or grayed button and call it greyedButton.  Go to the main stage add 2 instances of button and 2 greyedButton (just drag the library).  you have 4 instances on stage.  give the name of the instances of appeal and place them one over the other so you can see 2 buttons on the stage.  put the button greyed under the button.

    now with action script

    Button1.addEventListener (MouseEvent.CLICK, OneButtonClicked);

    function OneButtonClicked(event:MouseEvent):void

    {

    MovieTarget.gotoAndStop (1);

    MovieDescription.gotoAndStop ("One");

    Button1.visible = false; Here the button greyed will show

    }

    Button2.addEventListener (MouseEvent.CLICK, TwoButtonClicked);

    function TwoButtonClicked(event:MouseEvent):void

    {

    MovieTarget.gotoAndStop (2);

    MovieDescription.gotoAndStop ("Two");

    Button1.Visible = true; Here button1 will return to its orignal State

    Button2.visible = false / / here will show the button greyed

    }

  • can we put a button on the canvas of the battery

    Hello
    can we put a button on the canvas of the battery
    and if we write hide_view it works?

    Please guide
    Vikas

    Vikas,

    We can put the button on stacked canvas, and if you want to use HIDE_VIEW the canvas stacked in this button, then you must first move the cursor to another element that belongs to another canvas.
    OR
    You must set the properties navigable mouse and keyboard navigable of the button to FALSE.

    If this isn't what you want then please explain what you actually want to achieve.

    Kind regards

    Manu.

    If my answer or the answer to another person has been useful or appropriate, please mark accordingly

  • How to put the button submit as Checked

    Hello

    I need to adjust my login button submit as Checked. for the HTML input tag we have checked attribute, but in our jspx for command button how to put this button that checked.

    Someone can help me.

    you mean enter button don't call action?

    Move your af:form from the top of the jsf to your input fields all about; defaultCommand here is your id of the button.





  • Put the buttons on the side

    Hello
    I had a problem to put the 2 buttons in a facet. Any advice?

    ...
    < f: facet = 'end' name >
    < af:commandButton text = 'Save' id = "cb2" >
    < / af:commandButton >
    < af:commandButton text = 'Cancel' id = "cb3" >
    < / af:commandButton >
    < / f: facet >
    ...
    Best regards
    Human

    you have not closed the Panel group






    Here, it should be

  • Button side blackBerry 10 on P9983

    There is the button alttle between the side on the P9983 volume controls.

    What can I use for?

    It's called a Mute button. It goes to mute calls and music, it is also used for BlackBerry Assistant, you can go into the Settings - Wizard BlackBerry and disable the button mute to activate BlackBerry Assistant.

  • Put the pictures side by side in a new image

    Hello

    In my program, I had two (each 400 x 400 px) images I want to combine them into a single image (and save it on the disk).
    To do this, I extracted the image data and table construction allows to create a new image Board.
    Then I create a new image with dimensions 0,0-800 400 and use the new table of image as input data.
    The image is saved to the disk, but the two original images underneath the other.
    I would like to have them side by side, but I don't know how to do this.
    A screenshot of my original program is attached.

    Kind regards

    Björn

    There are two ways to leave the photo functions to do the work for you.  The most effective is to change the rectangle of the second image, but the code to change this to that and add this to it's a bit ugly, so I take the easy this time, but suggest that you write a little Subvi to simply move the rectangle.  You can choose side by side, on top, add padding, etc.

    Here is the ease (in code).

  • Put the pictures side by side + change layer source?

    I'm doing the following with a large amount of images named by chronological order:

    -duplicate a layer

    -Move to the right by the amount of its width

    -change its source of layer so the image is in order:

    [1] [2] [3] [4]


    The first image is called "IMG_1.jpg", the next "IMG_2.jpg" etc.


    So far, I found a way to move the layer duplicated to the right using this expression:


    thisComp.layer(index+1).transform.position + width


    Now I just need a way to define the source of the layer count + 1, also in a way like this:

    source. Name = IMG_ '+ 1'.jpg


    Is it possible to do this? Thanks for your help.


    To replace a layer with another source you select the layer in the timeline panel, and then select the new source in the project Panel, then hold down the Alt/Option key and drag the replacement layer to the project in the timeline panel and release the mouse button. All you have to do is to get the replacement layer anywhere in the timeline and it will replace the selected layer and take all of the properties of the layer.

    There is no way to do it automatically with an expression, but you can write a script that would replace all your layers at a time.

    This info available and more explanation is offered if you type "replace images in the timeline" in the search field help in the upper right of the AE

    I would probably approach this problem by selecting all images in the project Panel and then select new Composition of selected, then select single composition, then use the Panel align to align the images, and then animate the first image and the rest of the images to one of the parents.

    Perhaps even better option to create a file in Photoshop or Illustrator layered with all elements lined up, imports a model and then use the trick of parenting.

    If you need compensate animations so things are moving a layer at a time, then I would like to animate the first layer, create a preset, and then move the CTI to the start time of the next layer and apply the preset animation.

    I hope this helps.

  • How can I put three images side by side to create a banner in Photoshop?

    Hi all

    I am a new user of Photoshop. I'm taking three cropped images and place them next to each other (three images in a row) and make an image. If someone could write me Tips how to do this, I would be very grateful. Thank you!

    Hi Nicole

    Please go through this Article Three picture Photo Frame Template in Photoshop . It might be useful

    Let us know if this helps

    Concerning

    ~ Assani

Maybe you are looking for

  • import bookmarks to another user account

    Previously I use cell phone company with my user account A. I use firefox with bookmark.But due to a technical problem, my laptop not able to connect as user account A company. And now I can only log in as administrator account. And it happened so su

  • Why all the pop-up windows blocked, despite the option of popups block DO NOT checked?

    A few months previously, out of the blue, windows pop up never came on firefox.What I was doing was urgent, so I used IE (grrr!) instead.I still have this problem - despite the option 'block pop-up windows' is checked, work without popups.What can be

  • SAI - your campaign is incomplete - complete Setup

    What does this status mean? I have a custom banner created by producer Sai SAI. This announcement has been approved. I have a line that refers to this SAI. The last 3 days, I put a line for the next start, but the State has never changed. I deleted t

  • Still no update for Windows 10: 4 November

    I even forgot Windows 10 at this point because I'm especially a MacBook Pro user. I only use the Dell laptop for work. Regardless of all the criteria of material and book my way to update back before the end of July deadline, my Windows 7 laptop stil

  • HP Pavilion dv6000 BSOD continues

    I have a HP Pavilion dv6000 model number DV6853CL with Vista Home Premium 64-bit In my view, that the source of my problems comes from a virus. Awhile back, I was getting the BSOD, but I was still able to boot my system. After a few weeks, I was unab