Place a label in the middle of the container

Hello

I think it's an easy problem. But unfortunately I couldn't do it right, neither could find the answer in the forum. My eye looks like this:

cTitleBar = new Container();
cTitleBar.margins = Vector.([5,5,5,5]);
cTitleBar.debugColor = 0x33FF33;
cTitleBar.size = 10;
cTitleBar.sizeUnit = SizeUnit.PERCENT;
cTitleBar.flow = ContainerFlow.HORIZONTAL;
cTitleBar.align = ContainerAlign.NEAR;
cTitleBar.containment = Containment.DOCK_TOP;
cMain.addChild(cTitleBar);   // cMain is the main container
cTitleBar.layout();

var title:Label = new Label();
title.text = "My Title";
title.autoSize = TextFieldAutoSize.LEFT;
title.x = (cTitleBar.width - title.width) / 2;
title.y = (cTitleBar.height - title.height) / 2;
cTitleBar.addChild(title);

The title.x and the title.y has been set to the correct value, but the label was still appearing in the upper left corner of the container. How could I make it work?

Thank you very much

I did the same thing

Try this:

private var c:Container = new Container();
c.flow = ContainerFlow.HORIZONTAL;
c.align = ContainerAlign.MID;
c.setSize(700,400);
c.setPosition(162,100);

lbl1.width = 680;
lbl1.format = new TextFormat("Comic Sans MS", 80, 0x000000,null,null,null,null,null,TextFormatAlign.CENTER);
lbl1.text = "My Title";
lbl1.height = lbl1.textHeight + 5;

c.addChild(lbl1);
addChild(c);
c.layout();

Tags: BlackBerry Developers

Similar Questions

  • How can I create a label twist wrapped around a cylindrical container of a square image, like the label of the container of pringles chips paper?

    Hello

    I'll make a new packaging for a product that my company will launch next month. The packaging is cylindrical and paper twisted and wrapped around a cylinder.

    I finished the label in Adobe Illustrator, and it's a square image. Now, I want to design the label in the form of torsion that hurts the cylindrical container like the label of the container of pringles chips paper.

    Please give me some advice or instructions that may help me to design the label my desired form. Thank you...

    Kaddour,

    You may be, based on the version cut showing a cup which begins and ends at the level of the corners (guides are your friends):

    Round 1) create the complete label goes all the way, in the form of basic rectangular/square (works both a rectangle and a square, this last just have the same width and height), with all the works of art;

    (2) to decide the number of cuts;

    (3) create an oblique path right from the upper left corner (you can use the line Segment tool) for somewhere farther to the right, and then with the reference Point in the range of transformation the left superior value changes the value of W to the total width of the rectangle divided by the number of cuts, this will give you the right angle;

    (Pass 4) a copy of the straight path of 2) to the right by its value of W;

    5. Select two straight paths of 3) and 4) and Ctrl / Cmd + J to join them so create a parallellogram with twice the value of 3 W) / 4);

    (6 moving copies of the parallellogram left and right by the W of the value of 3) / 4), repeat until you have covered the original rectangle.

    (7) let the parallellogram on the far left where it is (covering the left upper part of the original rectangle) and move the others down by the height (of the original rectangle / the parallellograms), leave one where it is and continue with the remaining until they are all under one of the other;

    (8) copies of the original rectangle of 1 move) downwards by its height until you have rectangles behind the parallellograms.

    (9) for each set of parallellogram and rectangle, select both and object > clipping mask > make.

    (10) select and group;

    Now you should have the final shape and look of the rectangle cut as a group of clipping masks, done digitally; You can use as it is to cut a single label, or you can:

    (((11) copies of shifting to the right by the W of the value of 3) / 4) to have multiple labels to cut.

    This obviously requires a fairly precise cut, but it may be less critical than usual, given the nature of the twisted label.

  • When I place an icon on the home screen, can I change the label?

    When I place an icon on the home screen using firefox for android on my tablet from Samsung, the label is inserted for me. How can I change

    The easiest way is probably in bookmarks the page that you are willing to have the icon and by changing the name of the bookmark by pressing on long, long press again to add it to your screen.

  • I no longer live in the Middle East. How can I change my new place of residence in the USA? I do not need to deal with exchanges of currencies.

    I no longer live in the Middle East. How can I change my new place of residence in the USA? I do not need to deal with exchanges of currencies.

    Hello

    Please see using document https://helpx.adobe.com/x-productkb/policy-pricing/change-country-associated-with-adobe-id .html

    In order to change the country on your Adobe account.

    or you can sign up for the new e-mail address on www.adobe.com

    Hope this will help.

  • WPF, is there a way to link the label of the axis

    I have this XAML and I was wondering if there is a way to change the label of the axis of GHz to something else programmatically.  I tried the usual link and it did not work.

    It is just easier to use a TextBox control on the same place?

    Thank you!

                                








    With the help of Content="{Binding LabelX}" in the LabelTemplate won't work if Label is defined on an object with a property called LabelX . I think that what you want is something like this:

    Label="{Binding LabelX}">

            

                

                    Content="{Binding}" />

                

            

        

  • Make sure you separate words/labels to the title appear at times different CS5.5

    Hey,.

    I'm wanting to create labels to separate text for different words House on a title and I'm eager to each word to appear at a different time.

    I was curious to know if this is possible with this software and if so, how?

    Thanks in advance,

    A few choices of method, depends on exactly how we want him for the words/letters see.

    Here is an example of a possibility, with step by step with Photoshop.

    The Setup is that we want a title, with three lines of text, one line after another, leaving the previous on-screen text.

    1. In Photoshop, make the new Image to the file in the toolbar.
    2. One of the video presets, choose from the drop-down list, say HD 1920 x 1080 w / Guides.
    3. Before you click OK, verify the background is set to Transparent.
    4. Use the text tool to create your three short lines of text, color and with the police, you want. Each use of the text tool will create a new text layer.
    5. Use the alignment and Distribution in PS tools to get the arrangement, the three layers of text, you need/want.
    6. Save_As PSD, keep these three layers of text on backgroundTransparent.
    7. In PrPro w / 1920 x 1080 HD sequence (note: match the new Image preset to match any existing sequence - the 1920 x 1080 is just one example.)
    8. Import the PSD as a sequence, so as to NOT flatten layers.
    9. This will bring the new title sequence in the project Panel, and then you can open it to reveal the layers in the PSD.
    10. Drag them to the video tracks (above any video, or VT 1 up to 3 VT) and change their life to what you need.
    11. You can compensate for them, for the moment, or can adjust that, with keyframes. I like compensation, just so that I have a visual reference.
    12. Now, it's decision time. For example, I decided I want the three lines of text to fade in the place that I've created. I'm going to Keyframe the fixed effect > opacity to achieve this. I like doing that in the effects, with the individual text layer selected Clip Panel. (Note: you can use many effects, depending on what you want and also combinations of effects, all two fixed and applied - your imagination is the only limit.)
    13. All three layers of text have opacity to 100%, and this is where we want them to end up, but we start our first layer to 0% opacity. Before you do this, decide where in time, you want it to reach 100%. A keyframe of opacity, set of animation switched TO opacity. We now have the opacity to 100% from this point to the last frame of the Clip text layer.
    14. Go to the first image and add a keyframe of the opacity. That set at 0%. We now have a linear gradient, FRO 0 to 100%.
    15. You can change the linear nature, with curves of Bézier applied to keyframes. For all these permutations, I highly recommend the help file. For now, we will leave things linear, with a constant speed.
    16. If shift you the text layer Clips, you will do exactly the same thing. If not, then you just want to add a keyframe 100% more far along in time and place to go to the first image, go where you want opacity to start to go from 0% to 100% and place a keyframe, set to 0% opacity. What you have done is set the initial opacity to 0% for the time until the first keyframe, and opacity changes until it reaches 100% keyframe.
    17. Repeat for the third Clip of text layer.
    18. Fact.

    Good luck and hope that helps. Don't forget, many effects can be alterations to change over time. We could have done similar with the added effect > Gaussian blur.

    Hunt

  • Upgrade to Flex 4, Halo theme, embedded police does not work for the Label of the spark

    I am upgrading an application in Flex 4 to Flex 3.5 using the Halo theme.  If I get a spark in my application the spark label label does not make the text using the font I set in my CSS.  My MX labels make it very well.  Here is a sample application that replicates to my question.  Thus,.

    Compile and run using spark theme.  The two labels make the text with the correct font.

    Compile and run using Halo theme.  Only the MX label makes the text with the correct font.

    Is it not possible to do what I want?

    Thank you

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                      xmlns:s="library://ns.adobe.com/flex/spark" 
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      minWidth="250" minHeight="250">
         <fx:Style>
              @namespace mx "library://ns.adobe.com/flex/mx";
              @namespace s "library://ns.adobe.com/flex/spark";
              
              @font-face
              {
                   fontFamily: Verdana;
                   fontWeight: normal;
                   fontStyle: normal;
                   src: url("./style/fonts/verdana.ttf");
                   embedAsCFF: false;
              }
              
              @font-face
              {
                   fontFamily: VerdanaCFF;
                   fontWeight: normal;
                   fontStyle: normal;
                   src: url("./style/fonts/verdana.ttf");
                   embedAsCFF: true;
              }
              
              mx|Label
              {
                   font-family: Verdana;
              }
              
              s|Label
              {
                   font-family: VerdanaCFF;
              }
         </fx:Style>
         <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <s:VGroup>
              <mx:Label text="My text" />
              <s:Label text="My text" />          
         </s:VGroup>
    </mx:Application>
    

    I think you need to put the fontLookup:

    s | Label

    {

    do-family: VerdanaCFF;

    fontLookup: "embeddedCFF";

    }

  • How place of content between the header and tabs?

    I have the header part which must be constant through the portal but below that I have 3 links
    as I AM an employee, employer, broker...

    which showed that in the homepage above the tabs...
    How can I do this...

    How place of content between the header and tabs...: () kindly help...

    Hey djo
    Try these approaches and see if it works.

    1. in the header Section, page footer you shell header and add a Portlet header. This JSP file associated header Portlet will be all static content in the upper part. In the lower part, add these 3 links say right. Show these links only based on certain properties of the query as isHome. Now for the main book House and another page associate a BackingFile. In this backup file in the lifecycle methods preRender or handlePostBack, get BookManager instance and all pages and see which page is active. For this page, see its page definition label which will be always unique. IF the page def label is like home_page_def (it is the wording of the page def you give to the homepage), then set the value of the key in the request as isHome = true property. The only doubt is after book backingfile is triggered, the header needs to be reloaded, because only then can he pick up the attributes of the request.

    2. create a new portlet as HomePageLinks portlet. Its title property is not Visible and other properties of the UI as NoBorder, etc. NoTheme. The associated JSP will be the 3 links you mentioned fixed right. You can use css styles to make it right. Now dropping this portlet in the header Shell box. You have already HeaderPortlet in the upper part, lower than that, you will have this portlet HomePageLinks. Now associate a backup file for this Portlet show, only if the current active page of books is the home page comparing the label def etc. as mentioned above.

    In both scenarios, only concern is when clicked on different Pages, the entire portal is to be made directly from the header at the top. Only then the backup file will be set the key and the portlet HomePageLinks can show or hide as a result.

    Try to raise an event when the user clicks on the homepage. This port listening for that event can be HomePageLinks Portlet. I guess the event mechanism should work regardless of where the portlet is placed. In the event listner, see if you can show/hide this portlet.

    The only challenge is reloaded must section header whenever you click on a tab.

    Start putting a few files of backup and System.out.printlns to see if the header section gets recharged on, click on the tabs.

    These are just my thoughts on the top of my head. Other users of the forum may have better alternatives or a different version of the above approaches.

    Thank you
    Ravi Jegga

  • labels under the image buttons

    I add several buttons image in an HTML area. They all appear fine, but I can't find a way to display these button labels. I do not state these button labels. I guess that these labels are for the ALT for the IMG tag. Is there anyway that I can display the labels for the buttons?

    Thank you
    View

    I don't know how u put up these pictures... but if you manually insert it to the region of html with the IMG SRC tag, just set up an another TR under the image and set up another TD...

    in my case, im calling the images with javascript function button to reload a pre-image and switch on mouse... and I put in place a label like here

    
                         
                      
    

    It's just a BR tag to jump line... and the label is in the same link

    Published by: brugo 10/09/2009 13:53

  • How can I place a copy of the book of fonts on the desktop

    can I place a copy of the book of fonts on the desktop?

    Never move applications from the Applications folder.

    Instead of launching the book of fonts of your dock.

    The icon of the application book fonts looks like a book with a big F.

  • Turn on the labels of the buttons! Why are they turned off and I have to spend ages trying to find how to activate their!

    I have to waste time reset my toolbars after the bloody upgrade because I'm upset. Where do you turn on the labels of the buttons so I know what they are for love?

    Edited by a moderator because of the language. See the rules and lines guidelines .

    Hello

    The people who answer questions here are for the most part, other users Firefox dedicating volunteer their time (like me), not employees of Mozilla or Firefox developers.

    If you want to leave a comment for the developers of Firefox, you can go to the Firefox help menu and select submit comments... or use this link. Your comments gets collected at http://input.mozilla.org/, where a team of people read it and collect data on the most common questions.

  • The set automatic Letter Wizard in place my email with the erroneous e-mail servers. How can I fix this

    I use OS x 10.11.5. The set automatic Letter Wizard in place my email with the erroneous e-mail servers IMAP account. I use a POP3 account on the servers 'brighthouse '. Now my account sues IMAP servers "TWC" for mail entering and leaving. I also have what appears to be files duplicated in the sidebar to the mail for example app, I have a sent folder and a sent mail folder; even with junk and spam. I can't delete a file and have no idea how they differ. I tried deleting accounts and adding a new account, but I can not bypass the automatic detection and preserve characteristics even if I of delected as preferences.

    Is there a way to remedy this situation without reinstall OSX and start over?

    V/R

    Keno

    Just delete the account and establish a new

  • How to place multiple orders for the same address on the photos?

    Hello!

    I created several books on Photos and I would like to get printed and shipped to my address.

    Unfortunately, it seems that it is only possible to place an order at the announcement of time (a book both in my case) so pay the shipping costs for each order/book.

    Am I missing something here?

    Thank you in advance for your help!

    You can combine only multiples of the same item in an order.  If you have created several books, you will need to pay the shipping costs for each of them separately.

  • After you place a disc in the computer and clicking on file, I can't find burn it to disc to copy.

    Help

    After you place a disc in the computer to copy an album. By clicking on the file but I can't BURN TO DISC? copy the disc.

    You again to create a playlist before you can burn.

  • LabVIEW 13.0f2 crashes when text cut of some free labels on the block diagram

    While reviewing the documentation of a VI, I faced a LabVIEW crash. I can reproduce it in LabVIEW 13.0f2 with the following code.  Can anyone confirm that the content 'def' Cup free label and trying to stick to the free label with "ghi" produce error 0xBC0BF185?

    I can't reproduce this problem by any other cut and paste between the free labels on the left side of the BD.  The accident occurred only when 'def' cutting and trying to stick to the "ghi".

    Hi all

    I looked into this, and it is more general than just the madness in the label. I dropped the CAR 442743 for this behavior. It's an accident that can occur when cut and paste text between the free labels in 2013 of LabVIEW with the disabled automatic tool. This is related to the CAR 408955 (deadlock occurs when deleting a comment with the automatic tool off) that has been corrected in the Patch of f1 2013 LabVIEW. This case was not covered by that fix and will be fixed in a later version.

    Thank you

    Jeff Peacock

    Product Support Engineer | LabVIEW R & D | National Instruments

Maybe you are looking for