GetHeight() LabelField 0 back in the custom handler

Hello

I have a LabelField in a custom handler. When it is added to the screen and the subLayout is called the first time,

the LabelField getHeight returns 0, making the fields below stop it? After a few seconds, getHeight returns the

correct value and pop fields in place.

What I am doing wrong?

Looking for the getHeight() == 0 then by calling the round of new fact. DIY-mania!

Tags: BlackBerry Developers

Similar Questions

  • Create the custom handler class touch

    Hi all! I have a problem that seems easy enough to fix, but I'm doing it with reusable code, which is to do something I do not understand yet. I googled this continually and read dozens of articles and I'm still just as lost than when I started. I hope that human life can help me to make sense.

    I have a clip on the stage. When you press this clip, I want to play a certain slice of another clip for as long it is being touched. (This is a map of the United States, that display the name of each State that he's in a hurry).

    I COULD write 50 different functions, each to call a different image of the film displayName, or I could write my own custom event which would be able to receive every key event a string variable and then say displayName that frame to play.

    So basically, I have, for example:

    alaskaMovieClip

    displayNameMovieClip

    When you press alaskaMovieClip, I want to address to the string of the 'Alaska' variable to a touch custom event class, which will then a bunch of stuff as well execute displayNameMovieClip.gotoAndStop ('Alaska').

    1 is it possible?

    2. how? I'm if confused about how custom touch events are created and executed, I've read dozens of articles, and they have just the code that I do not understand. This tutorial should I be looking for that could help me?

    Thank you!!!
    Amber

    One way is to store a public var (say var state = "AZ"; for example) in your puzzleAZ. So you'd just:

    puzzleAZ.addEventListener(TouchEvent.TOUCH_BEGIN, unitTapHandler);
    
    function unitTapHandler (e:TouchEvent): void {
        e.target.gotoAndStop("Over");
        nameDisplay.gotoAndStop(e.target.state); // e.target.state is "AZ"
    }
    

    The other way is to let your MovieClip to send a custom event (which holds the 'State' var) Touch to start the event. Then the mother (or the main timeline or the document class) listen to the custom of your MovieClip event.

    // custom event
    package {
        import flash.events.Event;
    
        public class UnitTapEvent extends Event {
    
            public static const TAPPED:String = "tapped";
            public var state:String;
    
            public function UnitTapEvent(type:String, state:String):void {
                super(type);
                this.state = state;
            }
    
        }
    }
    
  • A matter of design using the custom in custom frames fields.

    A matter of design, which is a good implementation of the following?

    I read the articles in the Knowledge Base 'Create custom fields' and 'Create a custom handler for a screen presentation' and what I want to do is control any arbitrary custom field - a Manager custom.

    For example, if I have the following fields:

    1. Field
    2. Field
    3. Field
    4. Field
    5. Field

    I want the second and fifth fields to have a different margin, filling or the width of the first, third and fourth fields, I would by methods layout() and object to the second and fifth fields - which shall replace the custom method of the sublayout() Manager logic?

    Or can I add logic in the custom handler, I find the fields with the method getField() to get the second and fifth fields and change the margin, filling or width with the logic in the custom handler?

    What is the right place to put the logic?

    Thank you.

    the field can only work with the space assigned by the Manager. how he uses this space is to the field, he could see itself smaller, for example.

  • Security, I tried the custom settings, I went back to remember history, but key to REJECT 3rd-party cookies disappeared, now many 3rd party cookies is followed.

    After trying a story custom in the Section for the protection of personal information (not security as the first mentioned section), I went back to "remember history" but now, there are NO button to click to prevent the 3rd party cookies to enter computer. Now, a lot of 3rd party cookies appear very fast. I want the button to avoid 3rd party cookies returned so that I can use.

    Note that the choice "Use the custom settings for history" allows you to see current history and cookies settings, but by selecting that choice is not to make changes to the parameters of the history and cookies.

    Firefox displays the choice "To use the custom settings for history" as an indication that at least one story and cookie settings is not the default to make you aware that the changes have been made.

    If all the history settings are default, custom settings are hidden and see you "conservation rules: (never) don't forget history."

    "Never remember history" means that private browsing is active and "Always use private browsing mode" Gets a check mark.

  • I wan to save my history Web sites, but my computer does not record. I go to tools > options > privacy and try to "save history", but it goes back to "use the custom settings for history"... I'm all down on those checked so it should save, but it do

    I wan to save my history Web sites, but my computer does not record. I go to tools > options > privacy and try to "save history", but it goes back to "use the custom settings for history"... I'm all down on those checked so it should save, but it doesn't.

    Thank you for taking the time to help me!

  • IE8 and it just started with a lot of error reports and custom back to the home page

    Well for a reason my first thread is not here so Im start again, I have IE8 and it just started with a lot of error reports and custom back to the homepage it just on the same page of the article, I was reading and said that this tab was recovered, I end up having to close on restarting the program n also since I reloaded my xp cd my sound got rough n jumps, it was well before I did this if Im not sure what to do. Im not exactly smart pc and am afraid of doing something wrong then Im left to do very limited things, any help would be appreciated

    Hello mikegrimesWQ,

    Because it looks like you have reinstalled Windows XP, what happens when you turn on your computer?  Windows loads correctly and allow you to connect with success?  Have you completed all the updates of Windows since the relocation?  Do you get errors at any time?

    What version of Windows XP you are using and which service pack is currently installed?  I would say confirming all your drivers are recognized and updated.

    How to download updates that include drivers and hotfixes from the Windows Update Catalog

    Please let us know status.

    Thank you

    James

  • A few years back, I bought CS5. because of my house having to repair my CS5 has been lost in the move. Then I had to take care of my mother who died later of cancer. I have now found my product, but the customer service person said that there is no newspa

    A few years back, I bought CS5. because of my house having to repair my Adobe CS5 has been lost in the move.  Then I had to take care of my mother who died later of cancer.  I have now found my product but the person said the customer service there is no newspaper of me purchase of the product.  I can't use the product that I bought because I don't have the registration code.  So could I please get a refund and I will return the edition teachers and students of CS5.  Thank you.

    @

    Quickly find your serial number

    Download the CS5 products

  • Is there a c# example to use the event handler ExpressionEdit Custom Button control

    TestStand 4.1

    VISUAL C# 2008

    I've added the event handler for ExpressionEdit events as I would any event handler:

    exprEdit.ButtonClick += new NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEventHandler (_ExpressionEditEvents_ButtonClickEvent);

    Then, I create the event handler using the syntax

    public void _ExpressionEditEvents_ButtonClickEvent(NationalInstruments.TestStand.Interop.UI.ExpressionEditButton btn)

    {

    }

    I get the following error when I compile Isaiah:

    Error 1 no overload for delegate matches '_ExpressionEditEvents_ButtonClickEvent' 'NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEventHandler '.

    I guess that means that I don't have the right parameters or types in my statement of event handler, but it corresponds to the object browser.  Any ideas on what I'm missing?

    See my last edition but I think you want your handler to look like this:

    Public Sub exprEdit_ButtonClick (ByVal sender,
    NationalInstruments.TestStand.Interop.UI.Ax._ExpressionEditEvents_ButtonClickEvent
    (e)

  • I created a form.  I want to just fix the form of an email, send to be completed by the customer, the customer save the form and email completed for his back to me.  I don't want or need follow-up.  The way I understand adobe procedures is

    How I underdstand procedure with Acrobat Pro DC, it's that I first have to distribute the form.  The client cannot save the form, unless I do it, and then I send the form distributed to the customer.  On the side of the user, I think it will confuse most of the clients that I work with

    There are two ways of submitting the form by e-mail without using Adobe distribution methods and each method has some problems.

    The easiest way is to create a 'normal send button' and set the URL of submit button to point to an email address as "mailto:you[at]domain.com". You need to enable rights of use on the PDF file in order to receive all of the PDF document in your Inbox; because Adobe Reader users are limited to show only data formats (FDF, XFDF and XDP, XML, HTML) only. This method is very reliable; because submission will fail if end-users have not properly installing the software side mail client by default, or if they use the webmail.

    The most reliable method is to define the button submit to point to a script on the side of server such as ASP.net or PHP; because the script bypasses software email client-side and sends the request through a SMTP server. Both methods require that the end-users to submit using Adobe Reader or Adobe Reader browser plug-in. Integrated PDF by default "spectators" of the browser are not able to submit PDF forms, they may not read rights of use of Adobe, and they are not compatible with LiveCycle XFA forms.

    Do you know what type of PDF you use? Acrobat, LiveCycle XFA or XFA dynamic static

    You have a web server? If so, is this a PHP Apache or Microsoft ASP.net host?

    Visit the following Web site for examples of script:

    www.pdfemail.NET/examples/

  • Reset the VM between customer view (back to the current snapshot?)

    Hello

    I use VMWare View 4.6. I have an automatic / linked clone / dedicated pool with Win 7 VM.

    Resetting the client is allowed. Could someone please explain what are the exact measurements that are executed when a restart of the client view is triggered. I thought it was supposed to return to the virtual machine snapshot for reference, but it looks like it only turned on / turned off the virtual machine (i.e. ESXi reset).

    Kind regards.

    Hmm, the customer reset is a simple reboot and does nothing with the snapshot (unless you delete after the first active use)

    Its always been like that.

    Linjo

  • BTN in Movieclip custom back to the main timeline

    Hi all

    I have a btn in a Movieclip at some keyframe, the user is prompted to if they want to

    go back to make another selection of a category of choice (in the maintimeline)

    Like now, the code I have for the btn who jump you back to the main timeline is:

    on {(press)
    gotoAndStop (_root.stop (24));
    }

    _Root.stop (24) should be in quotes?

    That is to say. "_root.stop (24).

    Thanks in advance,

    Graeme

    Your code is not likely to work.  Try to use...

    on {(press)
    _root.gotoAndStop (24);
    }

  • BlackBerry - how to properly manage a TAP/CLICK in a custom handler

    I need to set up an event of click/tap for a custom Manager.

    The Manager contains a few items, but I need that all respond to the event Manager, so if the user taps/clicks No matter what item in the Manager, the event handler should be called also. What I've done is to attach a changeListener to a NullField which takes the width and height, but the fieldChanged method is never called

    public class TestManager extends Manager{
        private BitmapField _icon;
        private LabelField _lblTitle;
        private NullField nullField;
        public TestManager(Bitmap pIcon){
            super(Manager.FOCUSABLE);
            _icon = new BitmapField(pIcon);
            _lblTitle = new LabelField("This is the title");
            nullField = new NullField(NullField.FOCUSABLE);
            add(_icon);
            add(_lblTitle);
            add(nullField);
                nullField.setChangeListener(new FieldChangeListener() {
    
            public void fieldChanged(Field field, int context) {
                doSomething();
            }
        });
    
        }
    
        public void doSomething(){
        System.out.println("do something!!");
    }
        public void paint(Graphics graphics)
        {
           graphics.setColor(Color.DELIMITER_COLOR);
           graphics.fillRect(0, 20, Display.getWidth(), 50);
    
           super.paint(graphics);
        }
    
        protected void paintBackground(Graphics arg0) {
           arg0.setColor(Color.LIGHTGRAY);
           arg0.fillRect(0, 0, Display.getWidth(), Display.getHeight());
           super.paint(arg0);
        }
    
        protected void sublayout(int width, int height) {
            setPositionChild(_icon, UIFactory.getBestX(10), UIFactory.getBestX(8));
            setPositionChild(_lblTitle, UIFactory.getBestX(60), _topMarginTitle!=0?UIFactory.getBestX(_topMarginTitle):UIFactory.getBestX(15));
            setPositionChild(nullField, 0, 0);
            layoutChild(_icon, width, UIFactory.getBestX(50));
            layoutChild(_lblTitle, width, UIFactory.getBestX(50));
            layoutChild(nullField, width, height);
            setExtent(width, height);
        }
    
          protected boolean navigationClick(int status, int time){
                invalidate();
                doSomething();
                return super.navigationClick(status, time);
            }
    
    }
    

    How can I do this whole handler to respond to a click/tap?

    I use the API 5.0

    Thanks in advance!

    The problem with the help of the NullField of to do, it's that NullField is not programmed to handle any interaction except update.

    If you need to replace navigationClick, like you did for the Manager.  So that it connects to your plumbing FieldChangeListener (which is the right thing to do in my opinion. you must call fieldChangeNotify, for example):

            protected boolean navigationClick(int status, int time) {
                    this.fieldChangeNotify(2);
                    return true;
            }
    

    Now you will replace it in the NullFeld because it gets the focus.  You must make sure that nothing else in the Manager is focusable.

    But you will need some guidance in the manager who is has the focus, so that the user knows - especially for when the user is using the trackpad.  To do this, make a focusChangeListener for the NullField Manager and have the listener code set a flag if the focus was acquired or not and then invalidate() himself.  In object check the flag and if it is set, paint for focus, if not, paint for any developed.

    Come back if this is not clear.

    Byt the way, the sublayout in your manager looks a bit ropey to me, it's especially this:

    setExtent (width, height);

    You really want to show to what extent being large enough to accommodate all your field and no more.

    There are other things that I'm not sure, but if it works for you, then I guess it's OK.

    Good luck

  • OS 6.0 - Bug in the user interface for the custom control

    Hello

    I discovered a bug of UI on OS 6.0 with one of my UI controls. It seems to be linked to the control itself and how it is the calculation of the width. If my screen is full screen, painted correctly control, but as soon as I change the subLayout of the screen, the control still has a full screen width

    I spent a few hours trying to understand this one... but I can't seem to get their hands on the issue. I am sure that he as to do with the way in which it is the calculation of the width of the control of 99%... If someone could point me in the right direction would be appreciated...

    Thank you

    See the code snippet below

    UITest class

    public class UITest extends MainScreen
    {
      public UITest(long style)
      {
        super(style);
    
        add(new ButtonField("This is my test button", ButtonField.USE_ALL_WIDTH));
        TextBoxField ActionLog = new TextBoxField(0, 75, TextBoxField.USE_ALL_WIDTH);
        HorizontalFieldManager hfm = new HorizontalFieldManager(Manager.USE_ALL_WIDTH);
        hfm.setBorder(BorderFactory.createSimpleBorder(new XYEdges(), Border.STYLE_SOLID));
        hfm.add(ActionLog);
        hfm.add(new ButtonField("This is my test button", ButtonField.USE_ALL_WIDTH));
        add(hfm);
      }
    
      protected void sublayout(int width, int height)
      {
        layoutDelegate(width - 40, height - 40);
        setPositionDelegate(10, 10);
        setExtent(width - 20, Math.min(height - 20, getDelegate().getHeight() + 20));
        setPosition(10, (height - getHeight())/2);
      }
    }
    

    Class TextBoxField

    // http://na.blackberry.com/eng/devjournals/resources/journals/jul_2005/creating_textbox_field.jsp
    public class TextBoxField extends VerticalFieldManager
    {
    
      private static int PADDING = 2;
      private static int DEFAULT_WIDTH = 100;
      private int _managerWidth;
      private int _managerHeight;
      private String _pattern;
      private EditField _editField;
    
      public TextBoxField()
      {
        this(0, 0, Manager.USE_ALL_WIDTH);
      }
    
      public TextBoxField(long style)
      {
        this(0, 0, style);
      }
    
      public TextBoxField(int width, long style)
      {
        this(width, 0, style);
      }
    
      public TextBoxField(int width, int height, long style)
      {
    
        super(Manager.NO_VERTICAL_SCROLL | style);
        _managerWidth = width;
        _managerHeight = height;
    
        VerticalFieldManager vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL | style);
        _editField = new EditField(style)
        {
          public void paint(Graphics g)
          {
            super.paint(g);
          }
        };
    
        vfm.setPadding(PADDING, PADDING, PADDING, PADDING);
        vfm.add(_editField);
        add(vfm);
      }
    
      public int getPreferredHeight()
      {
        int fontHeight = getFont().getHeight() + (2 * PADDING);
        return (fontHeight > _managerHeight) ? fontHeight : _managerHeight;
      }
    
      public int getPreferredWidth()
      {
        if (_pattern != null)
        {
          return getFont().getAdvance(_pattern);
        }
        else
        {
          if (_managerWidth == 0)
            return DEFAULT_WIDTH;
          else
            return _managerWidth;
        }
      }
    
      public void paint(Graphics g)
      {
        super.paint(g);
    
        // BUG FIX: 17-08-2010
        // Before drawing the border, save the current color, after
        // change the color for the border, paint the border and re-set
        // back to the original color.
        int prevColor = g.getColor();
        g.setColor(Color.BLACK);
        g.drawRect(0, 0, getWidth(), getHeight());
        g.setColor(prevColor);
      }
    
      public void sublayout(int width, int height)
      {
        if (_managerWidth == 0)
          _managerWidth = width;
        else
          _managerWidth = getPreferredWidth();
    
        _managerHeight = getPreferredHeight();
    
        super.sublayout(_managerWidth, _managerHeight);
        setExtent(_managerWidth,_managerHeight);
      }
    
      public String getText()
      {
        return _editField.getText();
      }
    
      public void setText(String text)
      {
        _editField.setText(text);
      }   
    
      public int getTextLength()
      {
        return _editField.getTextLength();
      }
    
      public void setTextWidthPattern(String pattern)
      {
        _pattern = pattern;
      }
    };
    

     

    No, PopupScreen was still available. We have certainly used it in 4.2.1 but it was available before that as well.

    With PopupScreen, create it with your manager custom as a delegate.  In this handler, override sublayout to do most of the work. Sublayout of PopupScreen can contain a single functional element, if you wish: setPosition (x, y) (after the call to super.sublayout). SetExtent of the delegated manager will have an impact on the parent company PopupScreen fine (the screen apply the theme to the Manager and take more room, but it's OK).

  • Cannot navigate back to the previous screen (screen cannot be closed with the ESC key)

    Hi all

    I create simple BB app with eclipse jde 4.6.1, here the code example.

    class myApplication extends UiApplication
    {
        // applicatione entry point
        public static void main(String[] args)
        {
            // create an instance of our app
            myApplication theApp = new myApplication();
            // "run" the app
            theApp.enterEventDispatcher();
        }
        // app constructor
        public myApplication()
        {
         myScreen screen = new myScreen();
            pushScreen(screen);
        }
    }
    

    where my screen is like this

    public class myScreen extends MainScreen implements ListFieldCallback {
    private Vector menu;
    private ListField menuList;
    private MenuItem menuItem = new MenuItem("Details",100,10){
    public void run(){
    int index = menuList.getSelectedIndex();
    if (index == 1){
    Dialog.alert("list  "+index+" selected");
    }
    }
    };
    public void drawListRow(ListField listField, Graphics graphics, int index,
    int y, int width) {
         ListField menulist = (ListField) listField;
         MenuRowManager rowManager = (MenuRowManager)menu.elementAt(index);
         rowManager.drawRow(graphics, 0, y, width, menulist.getRowHeight());
    }
    
    public myScreen(){
    super(DEFAULT_MENU|DEFAULT_CLOSE);
    setTitle(new LabelField("myScreen", LabelField.USE_ALL_WIDTH | DrawStyle.HCENTER));
    
    this.addMenuItem(menuItem);
    createListMenu();
    }
    
    public void createListMenu(){
    menu = new Vector();
    menuList = new ListField(){
    protected boolean keyChar(char key, int status, int time){
    if (key == Characters.ENTER){
    // open next window
    int index = getSelectedIndex();
    switch (index){
    case 0: //
    break;
    case 1: //
    break;
    case 2: //
    break;
    case 3: //
    break;
    default: // about
    break;
    }
    }
    return true;
    }
    };
    menuList.setCallback(this);
    menuList.setRowHeight(60);
    menuList.setBackground(BackgroundFactory.createSolidBackground(Color.BLACK));
    
    // first item
    BitmapField mIcon = new BitmapField(Bitmap.getBitmapResource("image1.png"));
    LabelField lblM = new LabelField ("First list item", DrawStyle.LEFT);
    lblM.setFont(Font.getDefault().derive(Font.BOLD));
    MenuRowManager menuM = new MenuRowManager();
    menuM.add(mIcon);
    menuM.add(lblM);
    menu.addElement(menuM);
    
    // 2nd item
    BitmapField tIcon = new BitmapField(Bitmap.getBitmapResource("image2.png"));
    LabelField lblT = new LabelField("Theater Near Me", DrawStyle.LEFT);
    lblT.setFont(Font.getDefault().derive(Font.BOLD));
    MenuRowManager menuT = new MenuRowManager();
    menuT.add(tIcon);
    menuT.add(lblT);
    menu.addElement(menuT);
    
    add(menuList);
    }
    
    }
    

    and the definition of menuRowManager is like that

    public class MenuRowManager extends Manager
    {
        public MenuRowManager()
        {
            super(0);
        }
    
        // Causes the fields within this row manager to be layed out then
        // painted.
        public void drawRow(Graphics g, int x, int y, int width, int height)
        {
            // Arrange the cell fields within this row manager.
            layout(width, height);
    
            // Place this row manager within its enclosing list.
            setPosition(x, y);
    
            // Apply a translating/clipping transformation to the graphics
            // context so that this row paints in the right area.
            g.pushRegion(getExtent());
    
            // Paint this manager's controlled fields.
            subpaint(g);
    
            g.setColor(0x00CACACA);
            g.drawLine(0, 0, getPreferredWidth(), 0);
            //g.drawLine(10, 0, 10, getPreferredHeight());
    
            // Restore the graphics context.
            g.popContext();
        }
    
        // Arranges this manager's controlled fields from left to right within
        // the enclosing table's columns.
        protected void sublayout(int width, int height)
        {
            // set the size and position of each field.
            int fontHeight = Font.getDefault().getHeight();
            int preferredWidth = getPreferredWidth();
    
            // start with the Bitmap Field of menu icon
            Field field = getField(0);
            layoutChild(field, 48, 48);
            setPositionChild(field, 0, 6);
    
            // set the menu title label field
            field = getField(1);
            layoutChild(field, preferredWidth - 16, fontHeight+1);
            setPositionChild(field, 55, 30-fontHeight/2);
    
            setExtent(preferredWidth, getPreferredHeight());
        }
    
        // The preferred width of a row is defined by the list renderer.
        public int getPreferredWidth()
        {
            return Graphics.getScreenWidth();
        }
    
        // The preferred height of a row is the "row height" as defined in the
        // enclosing list.
        public int getPreferredHeight()
        {
            return 60;
        }
    }
    

    the problem is, when the first screen showed (pushed), I cannot "navigate back (close) the screen with ESC, won't my code?" Am I missing something here?

    Thanks in advance

    You want to substitute keyChar() into your custom domain.

    Don't forget that you must re - delegate all keystrokes that you do not consume.

  • Event Bubbling: Relay of the custom events

    Background:
    The bubbling in the action script 3 event causes an event to travel from the responsible subject through all its objects from parent to the root application. The event then moves back down to the original object.

    Goal: keep the data, the controller and the loosely coupled views
    1. When display objects are instantiated, they send an event by saying that they need certain information. The event has the type of information they need.
    2. the purpose of data capture this event, determines if it it has in memory. If it isn't, it retrieves information from a web service and pushes the result in a table.
    3. once the result in memory, it takes an event that contains the index of the result table.
    4. the view captures the result, out of the index and use it to link to the correct array element

    Result: The display is automatically updated every time that the data object is called by the web service with an update.

    In this scenario, nor the view or the data can be parents of each other, but each must be able to respond to the events of each and other. The reason is so that I can have multiple views generated dynamically, using the same data.

    Question:
    If the data (model) and the views are children of the same application, how does one maintain loose coupling between them?

    Current solution:
    The only thing I could get to is having the object application or controller catch all custom events and then their reconsignment to the children. The problem is that it is messy.

    I could also design a handler class that would have the forwarding of events to the right of the child hierarchy. I could include a private string variable that would capture the name of the object responsible for when my custom event was known as the class handler could do dynamic mapping.

    Is there a better solution?

    Thanks - I posted the question on something awful and someone suggested that I use a microwave recommended architecture on Adobe Labs called Cairngorm , I'll go through the documentation and give it a test drive this week.

Maybe you are looking for