get a label width c ++

import bb.cascades 1.2

Page {

    Container {
        background: Color.LightGray

        Container {
            horizontalAlignment: HorizontalAlignment.Center
            verticalAlignment: VerticalAlignment.Center
            topPadding: 250.0
            Label {
                id: dropLabel
                objectName: "dropLabel"
                text: "Select your country from the list below"
                textStyle {
                    base: SystemDefaults.TextStyles.TitleText
                    textAlign: TextAlign.Center
                    color: Color.Black
                }
            }
                DropDown {
                    objectName: "dropList"
                    selectedIndex: quoteApp.getIndex();
                    preferredWidth: quoteApp.getWidth();
                    Option {
                        text: "10 min"
                        description: "Sets the alarm to 10 minutes"
                        value: "10min"
                    }

                    // text only
                    Option {
                        text: "15 min"
                        value: "15min"
                    }

                }
            }
            Container {
                layout: StackLayout {
                    orientation: orientation.RightToLeft
                }

                horizontalAlignment: HorizontalAlignment.Center
                verticalAlignment: VerticalAlignment.Center
                        CheckBox {
                            objectName: "remember"
                            preferredWidth: 500
                            text: "Remember me"

                        }
                    }
        Container {

            horizontalAlignment: HorizontalAlignment.Center
            verticalAlignment: VerticalAlignment.Center
                Button {
                        onClicked: {
                            quoteApp.clickedButton();

                        }
                        text: "Submit"

                    }
            }

    }

}

http://S12.postimg.org/5rwtgd66j/Server_Selection.PNG

I want to put this page. I want to do the drop as width that select your country from the list below.

so why do I try part in bold

float ApplicationUI::getWidth()
{
Label * lb = root->findChild ("dropLabel");
return lb--> preferredwidth():

}

but the app crashes on preffferredwqidth

How can I solve this?

Someone also suggestiong to replace toppadding:250.0 for this page? It is good to use?

Look at spaceQuotas instead of hard coded values for the positioning of the controls...

http://developer.BlackBerry.com/native/documentation/Cascades/UI/layouts/

The width of an object can be found by attaching a layoutUpdateHandler...

http://developer.BlackBerry.com/native/reference/Cascades/bb__cascades__layoutupdatehandler.html

Tags: BlackBerry Developers

Similar Questions

  • Symbol of victory-box.  Can not get the Label AutoSize

    Hello

    I'm following the instructions on a tutorial on how to get the label on the 'Win'-> Checkbox symbol on automatic size:

    For example: I changed the label on the "Quantity" box, but it goes down.  I double click to align with the symbol-editing window.  I double-click on the text box and the top right blue square seems hollow (which is supposed to signify his now automatic resizing mode?), but when I go back to the main window.  The Word will not auto-size of the 'quantity '.

    The default value for symbols is "fixed" size 9indicated by the "Cube" at the top right in the text editing Mode.

    Just double-click, this little cube and it will return to a cicrle, which means that you have activated just this block of text for "Auto size". In other worlds, the limits of the block will be "conform to the / auto size" to the width of the text that it houses.

    h

  • How to get the label of the COM ports?

    If I go to System Manager, I got this information:

    But if I use the resource to find VISA, I get this:

    Is it possible to get the label?

    Try this:

    The list:

    (I have a special virtual TCPIP COM port on my machine, which gives error thats why the first element of the indicator table is empty for me)

  • height to get the label to determine it's belonging to a category

    I had something like this:


    var myClass:myClass = new MyClass;
    addChild (myClass.showLabel);

    Then, within this class, there is this code:


    public class myClass {}
    private var myLabel:Label;
    private var myCanvas:Canvas;
    public function myClass() {}

    myCanvas = new canvas;
    myCanvas.width = 30;
    myCanvas.height = 30;
    myCanvas.x = 30;
    myCanvas.y = 30;

    myLabel is new label;.
    myCanvas.addChild (myLabel);
    }

    public function showLabel (): Web {}
    MyLabel.set_Text = "example";
    myLabel.y = myCanvas.height/2 - myLabel.height/2;
    return myCanvas
    }

    When debugging I see that "myLabel.height" = 0. I don't know how to find it is the final height. I tried to use myCanvas.validateNow () myLabel.y in deciding, but it did not work.

    Hi lbarim,

    Try myLabel.measuredHeight instead of myLabel.height...

    Also write myLabel.validateNow (); as well as myCanvas.validateNow ();

    Note: myLabel.validateNow (); may not be entirely necessary... However try it once... you can get with myLabel.measuredHeight to...

    If this post answers your question or assistance, please mark it as such.

    Thank you

    Jean Claude Chari

  • Get a dynamic width of a dynamic button

    Hello, I'm trying to understand what is the width of a button dynamically generated compenent (in a forloop). Here is my code:

    var buttonFilterData:Button = new Button();
    set the data of the button - the filter data
    buttonFilterData.id = "instance__" + items ['data'];
    buttonFilterData.label items =
    ['label'];
    buttonFilterData.data = elements ;
    set the appearance of the text button
    buttonFilterData.setStyle ("fontWeight", "normal");
    buttonFilterData.setStyle ("fontSize", "10");
    buttonFilterData.setStyle ("textAlign", "Center");
    define the attributes of position buttons
    buttonFilterData.height = 20;

    THIS PART DOES NOT WORK!)
    Alert.Show (buttonFilterData.Width.ToString ());

    buttonFilterData.x = event.currentTarget.mouseX;
    buttonFilterData.y = event.currentTarget.mouseY;
    Add the event listener of keys used to drag the component
    buttonFilterData.addEventListener (MouseEvent.MOUSE_DOWN, dragIt);
    Adds the button to the Web as a child
    memberFilters.addChild (buttonFilterData);

    Im trying to get a button's width (the width will depend on the length of the text within the key) to determine where I wasn't the button to be placed in x, is to coordinate a canvas. Help!

    Click on the Web and you will see how the button is centered.
    The key is to add the listener to the button creationComplete.

    http://www.Adobe.com/2006/mxml '.
    layout = "absolute".
    xmlns:view = "view.*".
    >


    Import mx.controls.Button;

    private function clickHandler (e: Event): void {}

    create a new component button
    var buttonFilterData: button = new Button();
    buttonFilterData.label = 'Label XXXX';
    set the appearance of the text button
    buttonFilterData.setStyle ("fontWeight", "normal");
    buttonFilterData.setStyle ("fontSize", "10");
    buttonFilterData.setStyle ("textAlign", "Center");
    define the attributes of position buttons
    buttonFilterData.height = 20;
    buttonFilterData.addEventListener ("creationComplete", btnCreateCompleteHandler);
    buttonFilterData.x = e.currentTarget.mouseX;
    buttonFilterData.y = e.currentTarget.mouseY;

    cvs.addChild (buttonFilterData);

    }

    private void btnCreateCompleteHandler(e: Event): void {}
    var ix: int = e.currentTarget.x - (e.currentTarget.width / 2);
    IY var: int = e.currentTarget.y - (e.currentTarget.height / 2);
    e.currentTarget.x = ix;
    e.currentTarget.y = iy;
    }

    ]]>


  • Get the label name XControl leave XControl

    Hi all

    Is it possible to get in the name of the label of an XControl placed on a front panel from inside the XControl?

    I want to put some labels in the façade XControl name assigned to the XControl on a façade.

    Thank you

    So, you want a conscious XControl self-esteem?

    This will do.  Take the refnum in your state 'container' and follow these steps

    Shane.

  • I can't get the labels to print an entire page of the same label he will only print four. Help

    I try to print a full page of labels, all the same. I did in the past, but now it will only print 4. How can I get to print an entire page?

    Thank you for your help.

    Hello

    1. What is the brand and model of your printer?

    2. what applications printer do you use?

    I suggest you to change the print settings and check if the problem persists:

    Reference: To set the properties of the printer

    Hope the helps of information.

  • How to get 100% of width of Page 100% screen width

    How can I get my width of page in DW, actually cover 100% of the width of the page.

    Right now whenever I put a table to 100% of page width, there are significant gaps in areas of observation on the outskirts, as well horizontally than vertically.

    How to activate it?

    w

    Have you set the margins and padding to zero on the body?

    {body

    margin: 0;

    padding: 0;

    }

    As for 100% of table height, you can try the following article - if there is no 100% table height attribute.

    A table to enlarge or shrink to take account of whatever content is inside.

    http://apptools.com/examples/tableheight.php

  • Difficulty getting on component width dynamic (width is always 0)

    Hello

    I'm a newbie to flex and I was struggling with getting a width on components that I create in AS3 blocks. I have a TileList with a custom ItemRenderer component called ImageRenderer. When a user clicks on one of my articles, I would like to appear on the screen as well as a few other components. I have this work:

    public void onClick(e:ListEvent):void {}

    var i: Image = new Image();

    i.source =. img.source (e.itemRenderer as ImageRenderer);

    var h:VBox = new VBox();

    var t:TextArea = new TextArea();

    h.addChild (t);

    h.addChild (i);

    t.text = "Sample Text";

    h.x = 100;

    h.y. = 100;

    addChild (h);

    trace (h.width, h.height, root.width, root.height);

    }

    I get the Hbox to appear on the screen and displays the image, but the width and height that I get for the Hbox is always zero. Can someone tell me why this happens and how to fix it? I had another similar problem do anything else I ever solved, so perhaps my understanding of how flex calculates the width won't.

    Thank you

    I wonder if your trace is before printing the HBox has time to update its size - because of the asynchronous nature of Flex.  To find out, I put your trace() in a separate method and call this new onClick method using setTimeout(newMethod,500). Will give him half a second set to date. If it's always 0 try changing from 500 to 2000 (2 seconds). If it is still zero after that, then I'm wrong.

  • get the label from a selection of radio in a box of radio buttons

    I use a control of radio buttons, with four selections of radio in there.  I understand that this is an enumerated type, so the value is a 'number '.  When wire you this control to a statement button, the case is automatically generated with the selections radio labels.  Is there a way to capture the label of the button that was chosen?    I'm using LabVIEW 8.0 for this project.  Thanks in advance for your time.

    Hi bj,.

    Just use a FormatIntoString with the format specifier '%s '...

  • is it possible to get the label of any variable as a string?

    After all I have label indicator (or other) is there a function that reads the label and returns a string?

    Code and attached image (I use 8.2)

    First of all, the reference is a control - it is plugged into the connector pane.

    This will work only for numeric values.  I found a way to run generic references, but I still do and it is probably too much work, unless you really need.  There might be an easier way...

    When you this Subvi VI another, would connect you a reference to the object that you want as the label to the input terminal.

    Let me know how it goes...

  • How to get the label of the image?

    In accordance with common rules, I want to put all my as2 code in the first frame of a layer named 'code '.

    Then there was this question: how to implement that "certain actions when a given (better by using"image tag "not" frame index number") is entered to take ' in the 'framework of code' using as2.

    I can call to mind, listen to the message of frame entry of the current MC it's how can I check if the current entered image is the image specified?

    Any solution to this problem is welcome!

    Thanks in advance!

    Here is an example of what I mentioned in my first post:

    var labelA:Array = ["framelabel 1", "label 2", etc.];

    var frameA:Array = [];

    Preloader code

    function loadCompleteF() {}

    for (var i: Number = 0; i<>

    this.gotoAndStop (labelA [i]);

    frameA.push (this._currentframe);

    }

    startAppF();

    }

    //

  • Is it possible to get the image.width BEFORE the rendered image?

    I create an Image dynamically (in ActionScript) object and adding it to a cMain (Canvas container)

    I want to add it to a x / y location relative to an existing object in the canvas, so to do I'm putting myImage.x and myImage.y before making a cMain.addChild (myImage)

    Because I want to put the image right next to "SomeObject" into the canvas, I wanted to use something like:

    myImage.x = someObject.x - myImage.width;

    The problem is that Flex does not know the width of the image.  Of course, I could specify a specific width, but I actually do for the height (ie. myImage.height = someVBox.height), so it resizes the image and draw well, but does not give me the width of it.

    According to another discussion on this forum (http://forums.adobe.com/message/137573#137573), I tried to determine the width of the image in an event.COMPLETE handler, but even when the image is finished loading, height and width are still unknown (both show as '0');  It seems that I might be able to determine size in event. MAKE, but this does not mean the image has ALREADY been added to my painting and drawing on the screen?  At this point, it's a little too late, because I need the value of the coordinate x of the image BEFORE rendering of this.

    Is there a possible way to do it? (other than images to make sure the photo editing, they are all some dimensions and then hardcode these dimensions in...)

    Have you tried

    event.currentTarget.width ?
    
  • How do I get the screen width and size of the screen of the Blackberry storm?

    Hi guys,.

    I use the following code for the image capture.

    Bitmap bitmap = new Bitmap (Display.getWidth (), Display.getHeight ());

    try {}

    Display.screenshot (aBitmap);

    }

    In 4.3.0 (8120 device), when we use Display.getWidth () and Display.getHeight () it gives 240 x 320 respectively which has the correct size of the device.

    But in 4.7.0 Blackberry storm, when we use it gives data(240x320) even where the size of the device screen real is 360 x 480.

    So when we capture the image in the storm he's only half of the image. And also when hard code us the image like it from 360 x 480 size is thrown exception.

    Please suggest is there a way to capture full screen.

    Thank you

    Thanks for sharing the result. You can mark the thread as solved.

  • Cluster containing the label the button Get?

    In view of the reference to a button in a cluster control, how can I get the label of the cluster containing (parent)?

    More information on the task at hand:

    I have a pair of buttons ('read' and 'write') within a cluster, what I repeated in rows and then wrapped in another cluster for convenience of layout. I now want to manage the events of each button, grouped by lines and columns, as in the photo (also attached VI):

    My goal is to have a case of "read" event and one case of event "write", and according to what rank button is pressed, the code will be the index of an array of data for reading and writing. I know I could write separate events for each, or change the labels for each button to "Read button 0", ' Read button 1 "," read "button 2", but this is just an illustrative example for a much larger grid of buttons and other controls, and it is prohibitively expensive to turn on each of the labels, modify them, and then hide each of the labels.»»

    If this is not possible, I am open to other ways to address this problem that don't involve not copy paste cases of event for each line (since it is also prohibitive for the frequency at which cases are changed).

    Thanks in advance,

    Arthur

    You can use the node property of the object button called "holder".  What it does is return a reference to the object owner of this button, in this case the cluster.  Then you can convert this reference to a more specific class of the cluster.  Then use a property node to read the label.text.

Maybe you are looking for

  • I have to unstaill home flashflayer

    which player I need 2 download

  • HP Simple pass to dm4-2100se

    DM4-2100se I bought a HP Pavilion with a intel processor core I5 and Windows7 64 bit a year ago and i ' ved checked the warranty and it has already expired... in any case, the laptop doesn't have a few days back, (error was due to hard drive SMART er

  • Problems accessing the C code execution

    I had difficulties to get C code to run in my project bb10 test.h #ifndef TEST_H_ #define TEST_H_ #ifdef __cplusplus extern "C" { #endif int callMe(void); #ifdef __cplusplus } #endif #endif /* TEST_H_ */ test.c #include #include #include #include "te

  • Delete a user account that I made during file transfer.

    Original title: account issue. I recently bought a new computer to work. In the implementation, I made a user account. There were problems transferring all my files and I ended up buying a software for the transfer of the old computer. He set up a se

  • White screen white when running the app on device Builder

    Good day everyone. I got my application to debug and run on my device (sort of) of Flash Builder 4.5 by forcing it to use Flash player 10 and 2.5 forcingAirVersion but when my application starts all I get is a blank white screen. It is a and the main