Label BasicEditField

How can I change the BasicEditField so that the label displays on a separate above the value line?

By default displays the right of the label next to the value.

Thank you

It is not possible. Only the quick fix is add LabelField for purpose of label and then BasicEditField. Are not all labels in BasicEditField. Add these two domains to the vertical field manager.

It will be useful.

Tags: BlackBerry Developers

Similar Questions

  • BasicEditField custom with an editable area of the rectangle under the label

    Hi all

    I am trying to create an EditField customization where the label is above the editable, and you can write inside a rectangle.

    The problem is that I can't focus on the rectangle and I can't write to it.

    I replaced the BasicEditMethods as follows:

        public int getPreferredWidth() {
            return Display.getWidth() - _hpadding * 2;
        }
    
        public int getPreferredHeight() {
            return getFont().getHeight() * 2;
        }
    
        public void layout( int width, int height ) {
            setExtent(getPreferredWidth(), getPreferredHeight());
        }
    
        public boolean isFocusable() {
            return true;
        }
    
        public void paint( Graphics g ) {
            int defaultColor = g.getColor();
            g.drawText(_label, _hpadding, 0);
            g.setColor(_rectangleColor);
            g.drawRect(_hpadding, getFont().getHeight(), getPreferredWidth(), getFont().getHeight());
            g.setColor(defaultColor);
            super.paint(g);
        }
    

    If you have any suggestions, I like you a lot.

    Gabriela.

    You can use the API to achieve this.  Take a look at the post below for examples.

    http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&thread.ID=21371

  • Calculation of the minimum required size for a BasicEditField

    Hello

    I hope someone can help! This is continued in another post, I had about resize a BasicEditField so I could put a button on the same line.

    I re-size my BasicEditField to be half the width of the screen. I also set the maximum number of characters which they reached 6. When the user tries to enter the character 7 I get an alert that the field is full. I have a border around the BasicEditField and the user, it seems they should be able to enter more characters that is to say the space to enter the number is much larger than 6 characters.

    Does anyone know a way to calculate the size so the domain will be the right size it of to say to fit to the label and up to 6 characters, but not bigger?

    I hope I've explained this well enough to understand. Thanks in advance for any help

    Just put a code here:

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

  • Problem with maintaining the original text of basiceditfield even on unfocus after typing the text.

    I have a Basiceditfield with the original text. Here is the code:

    searchField = new EditField ("","", 1024, EditField.FILTER_DEFAULT | ") EditField.NO_NEWLINE)
    {
    protected void onFocus (int direction)
    {
    setLabel("");
    This.Invalidate ();
    };
    protected void onUnfocus()
    {
    setLabel ("Search");
    This.Invalidate ();
    };
    };
    searchField.setLabel ("Search");

    Text initially searchfield is "search". Onfocus his game to «» I type something in the searchfield, assumes that "ab". When the focus is removed from searchfield label has the value "Searchab". while I want to as "search". Help, please.

    on the focus, use getText, check if it is 'Search', setText to «»
    about onfocus, use getText, check whether it is "", set it to "search".
    on keyChar, use getText, check if "search, use setText for" ", and then return super.»

  • BasicEditField the cursor with the wheel of trapping

    Hello

    I created a customized to handle the keypress TrackballClick and Enter BasicEditField.

    It works very well on blackberry with a trackball (latest), but the cursor is trapped in the field with Blackberry with a wheel (like the 8703e). As soon as it gets the focus, the cursor may not go out (or an upper field) or one of the below

    Here is the code:

    public class SearchInputField extends BasicEditField implements TrackwheelListener {
        ConnectionScreen parentScreen;
    
        public SearchInputField(String label, String initialValue, int maxNumChars, long style, ConnectionScreen screen) {
            super(label, initialValue, maxNumChars, style);
            this.parentScreen = screen;
        }
    
        public int getPreferredWidth() {
            return Display.getWidth() / 2;
        }
    
        public boolean keyChar(char key, int status, int time) {
          switch( key ) {
            case Characters.ENTER:
                parentScreen.PerformSearch();
                return true;
            }
            return super.keyChar(key, status, time);
        }
    
        public boolean trackwheelClick(int status, int line) {
            parentScreen.PerformSearch();
            return true;
        }
    
        public boolean trackwheelUnclick(int status, int line) {
            return true;
        }
    
        public boolean trackwheelRoll(int amount,int status, int line) {
            return true;
        }
    

    Any idea?

    Thank you

    No, he stayed in the first.

    In any case, fixed it by returning false in the method of the wheel (do not know why, but anyway... )

  • Extension BasicEditField

    Hello

    I want to create my own implementation of BasicEditField which will limit the number of characters entered.

    In short, I want to just set up a way to set the maxLength.

    I am currently inside the keyChar (.), counting the number of characters and returns false if the maximum has been reached.

    Is this the only solution?

    Thank you

    G

    You can use this BasicEditField constructor

    BasicEditField (String initialValue, label As String, long style, int maxNumChars)

    where maxNumChars is the maximum number of characters.

    Press the button Bravo thank the user who has helped you.

    If your problem has been resolved then please mark the thread as "accepted Solution".

  • Change width BasicEditField

    How can I change the width of the BasicEditField, which, by default, puts on the screen.

    Thank you

    Arturo

    First of all, the getPreferredWidth will not help with BasicEditField. ButtonField, for example, uses during its layout(); Don't bother editing fields. getPreferredWidth/getPreferredHeight are mostly calls with permission and are generally ignored during the presentation of the screen.

    Second, your attempt with setExtent is a valid concept - you simply forgot to call super.layout in your replacement of page layout.  In fact, the simplest approach would be to calculate your required width (let's call it myWidth) and use it like this:

    protected void layout(int width, int height) {
      // calculate myWidth here or in constructor / setLabel / etc.
      // then invoke the following:
      super.layout(Math.min(width, myWidth), height);
    }
    

    If you're wondering how to calculate the necessary width, take a look at Font.getAdvance () methods. Add advance your label in advance of the wider character (say, 'W') multiplied by the desired number of characters.

    If you are never going to use setLabel on your areas of custom edition, do not forget to replace setLabel. Something like this should be enough:

    public void setLabel(String newLabel) {
      super.setLabel(newLabel);
      // calculate your new myWidth here unless you do it
      // inside your layout() override
      // then force re-layout using this:
      updateLayout();
    }
    
  • right-aligned a BasicEditField within the screen

    Hello

    How do your right justify a BasicEditField in a screen?

    If you do the following, framed in any case left field shows:

    Processes = new BasicEditField ("process", 7, Field.FIELD_RIGHT);
    This.Add (processes);

    If you create a LabelField, you can right-aligned it on the screen with this:

    This.Add (new LabelField ("Login al sistema", LabelField.FIELD_RIGHT));

    TKS.

    I wrote my own...

    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.component.EditField;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.container.HorizontalFieldManager;
    
    public class JustifiedEditField extends HorizontalFieldManager implements FieldChangeListener {
    
        LabelField lf;
        EditField ef;
        int dw = Display.getWidth();
        int rightMargin;
    
        public JustifiedEditField(String label, String value, int maxChars, long style) {
            super(USE_ALL_WIDTH);
            ef = new EditField(null, value, maxChars, style) {
                protected void onDisplay() {
                    update(0);
                }
    
                protected void update(int d) {
                    super.update(d);
                    int efw = getFont().getAdvance(super.getText());
                    setPosition(dw - efw - rightMargin, 0);
                }
            };
            ef.setChangeListener(this);
            lf = new LabelField(label);
            add(lf);
            add(ef);
        }
    
        public LabelField getLabelField() {
            return lf;
        }
    
        public EditField getEditField() {
            return ef;
        }
    
        public String getText() {
            return ef.getText();
        }
    
        public void setRightMargin(int m) {
            rightMargin = m;
        }
    
        public int getRightMargin() {
            return rightMargin;
        }
    
        public void fieldChanged(Field field, int context) {
            invalidate();
        }
    
    }
    
  • print labels easy without using Contacts

    Print the sheet of labels with different addresses with Word for Mac

    Is this a question?

  • Labels missing text in the toolbar of Mail - El Capitan

    So yet another improvement of Apple... How do I bring back labels of text next to the icons? -they are missing in Relpy & Forward.

    Never be deleted.

    Right-click on the toolbar, and then select your desired vision.

  • Apple Mail alias labels

    Hello, I know I can see the color of the label that I put to any alias that I created in iCloud.com. Is anyway so he could reflect on the real Apple Mail in Mac OS or iOS?... Because all email sent to one of my aliases reflects just like any other email going to my email main iCloud. Thank you!

    What do you mean by 'reflect on the real Apple Mail'?

  • Use the 2nd column for the label data

    This should be easy. Online help for the numbers shows an example under Add graphics > adjust figure brands and labels.  My table is a simple 2-d column chart. In a single column, I have the weight in pounds, and in the second column, I have a date. When I have only the weight column selected in the form of data, I get a graph that is almost perfect, but there is no date label. When I try to include date data, I have a reverse relationship X and Y. Once I selected a cell as reference data, it doesn't have any way to deselect. What I want to do is chart weight against date and have the date appear as a label.

    Any advice is welcome.

    Hi innerserenity,

    I swapped the order of the columns. Column A is a column header.

    Kind regards

    Ian.

  • inscription in labels

    Hello, I have a list of addresses on the Pages, how do I print labels?

    I think you need to "merge" or "data fusion".

    Check out this link.

    https://iworkautomation.com/pages/script-tags-data-merge.html

  • How to make mailing labels?

    How can I make mailing labels?  Pages give models of envelopes and cards, but not the labels.  What gives?

    Access the site Web of Avery.

    Download no matter what model of Word want you and open it in Pages.

    or

    Make a group of your mailees in Contacts and those of all models in its print print dialogue.

    Peter

  • Printing labels direct mail from a worksheet using iWork 09

    I know how to use iWork 09 to perform a normal mailing.  However, to print mailing labels, I have to say that each label is NOT a new page.  By example, if I use 2 "x 4" labels, I need to print 10 labels on each physical page.  Is this possible?

    Thank you.

    If you do not find a way to do it with Numbers/Pages (I don't know of a way, but I do not know much Numbers/Pages), you can download and install Avery Design and printing software. You can save the data of numbers in an Excel format and then import them to the Avery software: http://www.avery.com/avery/en_us/Templates-%26-Software/Software/Avery-Design--P rint.htm

Maybe you are looking for

  • monitors external macOS Sierra + MacBook Pro 15 "+ 3 = gel

    This facility has worked with El Capitan (2 Thunderbolts-> DisplayPort + HDMI 1 = 3 monitors). Update of macOS Sierra - as soon as I connect a 3rd monitor (any order) - it freezes the whole system. Two monitors works very well If I boot with three mo

  • Assigned ip address

    Hi all My MacBook Pro has problem to connect to my wifi, it says "wifi a self assigned IP address 168.254.98.138 and won't be able to connect to the internet. I decided to do a clean install of El capitan and I still have the question, I'm also under

  • Think Portégé Z30 (16Gb and 256SSD) - how noisy is the fan?

    Hello Is the cooling fan on the Portege Z30 with SSD, strong or weak? Reason I ask---> I have a Toshiba Portege R700 with HARD drive, which is 3 years old now and it's great except for the sound of the cooling fan that is. (1) always active.(2) chang

  • Satellite L30 PSL33E - how to access the recovery partition

    Hi all I have a L30 (psl33e) who has the tact recovery partition, but I can't find how to access. I don't remember a CD recovery and thought that now zero or F10 key when turn the laptop would allow me to recover the system. If I need a recovery CD t

  • What modem do I need for R6250 - I didn't realize I would need one!

    I bought a Netgear R6250 to Christmas and that you barely round to open the box. The instructions say to connect it to your modem, but I do not have a modem, only the router free TalkTalk sent me. I just assumed, I would connect and here I am. What s