Is it possible a multiline EditField?

I know that editfields automatically resize when text occupy several lines, but by default, they have a line height. I need an EditField with n lines by default (when it is empty).

Now, I used a VerticalFieldManager substituted with a minimum height, where I put the (built with the USE_ALL_HEIGHT style bit) EditField, without success. The manager gets the minimum size, but the field keeps having a single line.

This will help you.

http://NA.BlackBerry.com/eng/devjournals/resources/journals/jul_2005/creating_textbox_field.jsp

Tags: BlackBerry Developers

Similar Questions

  • Is is possible to copy multiline text / indented in the JSX Illustrator Clipboard?

    Hello

    I am trying to copy some channels to the Clipboard of the user and am currently using this function:

    function copyToClipboard (text, doc){
         doc.layers.add().textFrames.add().contents = text; 
         doc.layers[0].hasSelectedArtwork = true;
         app.copy();
         doc.layers[0].remove();
    }
    
    

    which was provided on these forums

    Currently, my only problem is, he copy a single text.

    If I copy "Hello\nWorld", it is copied as "HelloWorld".

    The same with "\tHello\n" which I hope should be copied in the

    Hello

    World

    Anyone has any advice on how to work around this problem?

    substitute \r \n

  • Multiline center text

    How to center the multiline text?  I have a basic title and I typed in just one line, all looks good, focused correctly. Then I add another line to this text and what is more centered. The first line centered but stayes new line appears underneath and the top line is not upward to accommodate the new line to keep all the centered text.  Is it possible to do instead of the eye?

    According to the number of rows you need and how big do and how great the chassis, I usually do this by moving the base line. Eight lines something like 200 for the HD to the default size, four lines earlier, four below the baseline.

  • EditField: protected boolean insert (...) not called if the device uses VirtualKeyboard

    Hi all

    I extend the EditField class to intercept the entries of tank / backspaces and do something. I would outweigh all the methods of the superclass:

    protected boolean insert(char arg0, int arg1);
    public int insert(String text);
    protected int insert(String text, int context);
    
    protected boolean backspace();
    protected int backspace(int count, int context);
    public int backspace(int count);
    

    I tried on a 8520 (which has a physical keyboard) and the methods overridden were correctly when you type something in the field. However, this is not the case on a touch device (tried on a 9380). In this case the text is typed and showed correctly in the EditField custom, but not the method above is called never. I am quite confused...

    Is anyone of you know how to insert text in the virtual keyboard in the EditField? Is it possible to intercept these events?

    See you soon,.

    Beto

    The problem with keyChar and keyDown is that the char to insert depends on the keyboard layout, I didn't want to do something that it is already done by RIM.

    However, I have tried those overring however, but keyChar is never invoked, and keyDown gave place to a chariot double inserted in the editfield...

    In the end, I followed a suggestion made by @peter_strange in another post (I'll add the link if I managed to find it again) and put a FieldChangeListener on the edit field. When field changes, if the context is 0 (user action), I check if the text is changed and do what I have to do...

    Thank you.

    Beto

  • Possible to click on the URL in the label?

    Hello

    I do an application that can show the comments people have submitted - I would like to be able to allow the user to click a link in the comments and either open the browser or a webview at this link.

    Is this possible? I tried searching but I'm not sure on the wording of my request.

    Way the easiest is the sequel:

    {Label
    text: qsTr ("Plese don't hesitate to provide feedback to http://blackberry.hubalek.net")
    Multiline: true
    Content.Flags: TextContentFlag.ActiveText
    }

    Content.Flags: TextContentFlag.ActiveText does the trick.

    If you like my solution please accept my answer

  • Cannot remove the tank on once implemented editField keyChar

    In simple codes below, there is an editField in the screen. For Storm OS 4.7, once I entered a word in the edit field, I can't use the BACKSPACE key to delete any letter. The only way is to add a letter so that all letters are highlighted. Then only the BACKSPACE key will seek to remove the letters.

    If I set the keyChar method comment, I can add/remove letters freely.

    Did I miss something in the keyChar implementation and this removal of cuased letter is not not possible?

    Thank you

    class HomeScreen extends UiApplication {
    
        public static void main(String[] args)
        {
            HomeScreen app = new HomeScreen();
            app.enterEventDispatcher();
        }
    
        HomeScreen() {
            pushScreen(new EditScreen());
        }
    
        private class EditScreen extends MainScreen {
    
            EditScreen(){
                add(new EditField(EditField.EDITABLE));
            }
    
            protected boolean keyChar(char key, int status,  int time){
                boolean result = false;
                if (key == Characters.ESCAPE){
                    Dialog.alert("Escape key is pressed");
                    result = true;
                }
    
                return result;
            }
        }
    }
    
    protected boolean keyChar(char key, int status,  int time){    if (key == Characters.ESCAPE){          Dialog.alert("Escape key is pressed");
    
            // consuming event if escape pressed         return true;       } else {         // for non-escape keys passing call to the parent          return super.keyChar(key, status, time);                        }}
    
  • help with my HorizontalFieldManager & EditFields on the same line, 2nd column is not displayed

    Hi all, I've written a bean (called LabelAndEditField) that sets out a label and editfield as follows

    someLabel

    _________________

    |                                 |

    -----------------------

    It seems to work perfectly when it is the only component on a line of a

    VerticalFieldManager

    now I want to reuse this compenent such that I can have a screen that looks like

    someLabel another label

    ______________              ______________

    |                                 |             |                                |

    --------------------------             --------------------------

    and perhaps a third column.

    However, when you add my components of LabelAndEditField, the 2nd does not appear

    I used a HorizontalFieldManager and make

    HFM HorizontalFieldManager = new HorizontalFieldManager();

    HFM. Add (new LabelAndEditField ("someLabel"));

    HFM. Add (new LabelAndEditField ("another label"));

    then I just on the screen

    Add (hfm);

    but it does not show my second column, the second component of the LabelAndEditField

    Here is the snippet of code below, some can please help me get this to display

    (Sorry, that the code of my insert is wacked)

    public class LabelAndEditField extends VerticalFieldManager
    {
        private EditField _editField;
    
        public LabelAndEditField(String label,
                                 String initialValueOfTextField,
                                 int maxChars,
                                 long style)
        {
            super(NO_HORIZONTAL_SCROLL);
    
            add(labelField);
    
            HorizontalFieldManager textMgr = new HorizontalFieldManager(
                    Manager.NO_HORIZONTAL_SCROLL
                    | Manager.NO_HORIZONTAL_SCROLLBAR);
    
            _editField = new EditField("", initialValueOfTextField, maxChars,
                         style | EditField.NO_NEWLINE | EditField.FOCUSABLE
                         | EditField.NON_SPELLCHECKABLE
                         | Field.FIELD_VCENTER | Field.FIELD_LEFT);
    
            textMgr.add(_editField);
    
            add(textMgr);
    
        }
    
    }
    

    and the code that adds as that on the screen

    super(NO_HORIZONTAL_SCROLL); // this is a VerticalFieldManager
    
    HorizontalFieldManager rowMgr =
         new HorizontalFieldManager(Manager.NO_HORIZONTAL_SCROLL
                 | Manager.NO_HORIZONTAL_SCROLLBAR);
    
    LabelAndEditField col1=
           new LabelAndEditField("some label","initial value",12,Field.READONLY);
    
        LabelAndEditField col2=
           new LabelAndEditField("another some label","initial value",12,Field.READONLY);
    
    rowMgr.add(col1);
    rowMgr.add(col2);
    

    did anyone see anything wrong with that?

    As you can see for yourself, there is no place for the mktShare.  Try to go with FlowFieldManager and no HorizontalFieldManager as a container for your gadgets MyLabelAndEditField and see

    There is another possibility:

    The key in the code I provided is the super.layout (myWidth, maxHeight).  This myWidth tells your EditField its maximum size in pixels.  If you want to further restrict the domain, you have several options.  The only problem is - if you limit it too much, you will not be able to see the rest of the field.  To solve this, wrap your EditField (in which you now don't have to override the layout) in a HorizontalFieldManager (HORIZONTAL_SCROLL) (all this inside your MyLabelAndEditField) and limit the Manager rather than the field itself.  Then your customer will be able to scroll through the left field and right.

    In order to limit your HorizontalFieldManager, give him the width that you want in pixels (add that, as a parameter to the constructor of your MyLabelAndEditField) and substitute his sublayout like this:

    HorizontalFieldManager textMgr = new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL | Manager.HORIZONTAL_SCROLLBAR) {
      protected void sublayout(int maxWidth, int maxHeight) {
        int myWidth = Math.min(_desiredWidth, maxWidth);
        super.sublayout(myWidth, maxHeight);
      }
    };
    

    Thanks to his style HORIZONTAL_SCROLL, the infield will be almost infinite width, so the EditField inside fortunately "will display" all his characters.

    Then, when you design your MyLabelAndEditField, give him a maximum pixel value.  Say, you want three areas in a row.  Take your Display.getWidth (), subtract the margins planned, divide by 3 and pass that value to each of these areas.  Then add them to a HorizontalFieldManager (line2mgr in your example) and check the result.

    You seem to be competent enough to easily integrate my illegible bubbles in your code - let us know the results.

  • EditField with button on a single line

    Hello

    How can I put a text field and a button on the same line field?

    Is there a way to recover the image of contacts to use as a bitmap on the button field?

    How is it possible that it is not a component already built for an edit field phone number with key contacts on the side?

    Another question: is it possible, on the same line, add a horizontally centered label, and a button left-aligned?

    Thank you

    an editfield uses the width full-screen by default. You can change this by substituting getPreferredWidth or by using a custom layout.

    Yes. I use this code:

    if (blackberryContact.countValues(BlackBerryContact.PHOTO) > 0) {
      byte[] photoEncoded = blackberryContact.getBinary(BlackBerryContact.PHOTO, 0);
      byte[] decodedPicture = Base64InputStream.decode(photoEncoded, 0, photoEncoded.length)
    }
    

    I guess that the field is not commonly used and can be developed easily.

    Yes, with a custom presentation: http://supportforums.blackberry.com/t5/Java-Development/Create-a-custom-layout-manager-for-a-screen/...

  • Custom for an EditField method?

    Hello

    I have revised my strategy for this project (a previous publication wrote to ask for the help of tables and by assigning a "ID" to an EditField).

    I wonder if it is possible to create a custom method to the EditField, which is able to store a string or an integer?  I looked at the CustomTextField post (http://supportforums.blackberry.com/t5/Java-Development/Stop-edit-field-from-wrapping-text/m-p/25528...) and I found some useful information, but this type of procedure is not covered.

    Here's an example of how this might work (and which might look like the code):

    (MainScreen)
    ...
    int ID = 0;    //integer variable declared
    add(new customeditfield("Text...", ID);  //customeditfield is added to the mainscreen
    
    ...
    
    //customeditfield class declared
    class customeditfield extends EditField{
    
        public customeditfield(String string, int recordid) {
            setText(string); //sets contents using setText method
            RecordId(recordid); //stores recordid using RecordId method
        }
        protected void RecordId(int integer){
            //store the contents of "ID" the variable that was set
                    //when the customfield was added to the screen for
                    //future use
                    //not sure what this code would look like???
        }
    
    }
    

    Any ideas?

    Thank you!!!

    Hello world

    I managed to find a solution after consultation of a text of Java late last night.

    That's what I came up with the option - compatible with your suggestion of Peter!  And you're right - I'll make a change of the variable name as well.

    public class customeditfield extends EditField{
        private String recordID;
    
        public customeditfield(String string, String IdVariable) {
            setText(string);
            setRecordId(IdVariable);
        }
        protected void setRecordId(String ID){
            recordID = ID;
        }
        public String getRecordId(){
            return recordID;
        }
        public boolean invokeAction(int action){
            //I createdthis editfield just to check to see if each
                    //new editfield was storing the correct id variable
                    myeditfield.setText(getRecordId());
            return true;
        }
    }//closing bracket for main class
    

    Thanks for responding to my post!

    Yes, the goal is to connect the data in each editfield to a record in a database.

  • Update of the EditField values

    In my form, I have a text field with the value assigned to him and it seems while loads the form and action button click, I have to place the choice selected the choice field in the editfield, pblm that I face is, the values of selected field gets added to the edit created by default initial field value

    What method can be used to clear the editfield values completely and add the new value to it?

    Concerning

    Rakesh Shankar.P

    Hi guys, I found a possibility, first I created an emptyediitfield with the setText() method I gave the entry, that's all, and by clicking on each button and I put new values.

  • How to copy a text editfield on popupScreen

    I have an editfield on popupScreen and I put a text there, but how I can copy the text and paste it into another application. I don't know it's possible.

    Kind regards.

    You get this free feature if you leave the system adds the elements of the standard menu of fields like BasicEditField.  If you use your own domain, you can use the Clipboard If you want and put things in there and get stuff from there.  See the Javadocs of the Clipboard.

  • Two focuses on one single screen is possible?

    Hello

    I want two focuses on one single screen is possible?

    My requirement is the selection of the city in the list of cities, good now I get city selected in the list, but my requirement is developed (IE cursor) is must in search box as below img and scroll screen is also necessary.

    now im getting the names of the cities according to the type in the search box, but my requirement is cursor should stay in the find what box only during the scrolling of the screen using touchpad (i.e. navigationmoment) and slide the screen (TouchEvent). Please help me with this...

    Sorry for my English if someone can't understand...

    Thanks in advance...

    Hi Lacouture

    http://supportforums.BlackBerry.com/T5/Java-development/focus-on-multiple-field-like-task-and-Memopa...

    The thread above gives us the solution that you need.

    check it out... main logical thing is that

    We use below the code snippet in the paint of your field method (i.e., EditField/BasicEditField/TextField) regardless of the domain you use for entering text in this...

    protected void paint (Graphics graphics)
    {
    getFocusRect (new XYRect());
    drawFocus (graphics card, true);

    Super.Paint (Graphics);
    }

  • How do EditFields width and much more...

    Hello

    I'm putting two small EditField on the same line, but nothing helped. I tried setting with as you see below, but it always shows only the first field. Any suggestion is appreciated.

    Here's my simple extention of editfield:

    private final class halfEditField extends EditField
    {
    private halfEditField (label As String, String initialValue, int maxNumChars, long style)
    {
    Super (label, initialValue, maxNumChars, style);
    setExtent (Display.getWidth () / 2, getHeight());
    }
    }

    I was hoping by defining the scope of half the width of the screen, both will not fit on the same line. Should I have tried with smaller width, say Display.getWidth () / 2 - something?

    I don't want it to be horizontal scrolling, even if I tried, but I suppose that is a function of the screen itself main drop-down. Anyway I didn't ' want to scroll.

    A relevant question, it is possible to have an EditField with lable with a different color? I mean real editable rectangle stand out somehow and distinct from the label? The default value is very lame and does not suggest to the user that he is in fact a rectangle to edit it. Again, I prefer to avoid border addign since it will thicken up the field and uses the alarmist real state on the screen.

    I use the component 6 with Simulator 9800 on eclipse.

    Thanks for your suggestion.

    You can't do this in the constructor. You must replace getPreferredWidth() and probably layout (int, int). Something like this should work:

    public int getPreferredWidth() {    return Display.getWidth() / 2;}
    
    protected void layout(int width, int height) {    width = Math.min(getPreferredWidth(), width);    super.layout(width, height);}
    
  • Binder EditField in a table?

    Is it possible to have multiple instances of an EditField bearing the same name and are stored in a table?  My problem is that I need the user to be able to enter as many times as they need to in a certain area. E.g.  I have a product number field, they could enter a serial number, or they could enter the 50. So I want something like

    EditField efProductNumber = new EditField ("number of product :","");

    Add (efProductNumber);

    Add (efProductNumber);

    There is other things as a listener to another field of add (efProductNumber) so I would be able to create fields on the fly if needed.

    Any ideas?

    ZC

    Welcome to the forums!

    I assume you have some kind of misunderstanding about the "field name" - there is no such thing!  There could be a member of class/variable named efProductNumber, but it only that contain a reference to an instance of the EditField class.

    What you want to do is probably something like this:

    Vector productNumbers = new Vector();

    EditField efProductNumber.

    The string number;

    ...

    in a loop or a method called at various times somewhere in the code

    efProductNumber = new EditField (...);

    productNumbers.addElement (efProductNumber);

    Add (efProductNumber);

    ...

    Once the user has entered all the codes, it wanted to

    for (int i; I)< productnumbers.size();="" ++i)="">

    efProductNumber = productNumbers.elementAt (i) (EditField);

    number = efProductNumber.getText ();

    do something with this number

    }

  • How to set the caret at the end of EditField

    Hi I have an editfield, who receives a default value in the constructor.

    I want the caret to show at the end of the editfield, so that users can automatically

    continue to add more letters to the default text. (Right now the circumflex accent always starts at the beginning of the text, so type pushes the letter at the beginning).

    Is it possible to do this?

    Thank you

    Dan.

    You can use

    setCursorPosition(int offset)
    

    Kind regards

    Karan.

Maybe you are looking for

  • Icon strange sudden appearance between the address bar and search engine

    A weird icon suddenly appeared between the address bar and search engine... It looks like a 'ball' for a character of cardboard. Cannot understand the source or meaning. Thank you in advance.

  • BDP-S370 &amp; Hulu more

    I just signed up for Hulu Plus with the understanding that I could watch on my TV via my BDP-S370. I tried for several hours now, but I get an error that says: "The service is not available at the moment; reference 15 "code Any help would be most app

  • Satellite L300 PSLBGE network connection drops randomly times

    Hey,. I had this problem with my laptop because I bought 1.5 years ago.Now I launch Windows 7 x 64 with the latest bios (version 2.20 - WIN; day 25/02/10), chipset and wireless (the card is a: Realtek Wireless LAN Adapter 8187 B; driver version: 62.1

  • Register shift when indexing tables in formula node

    Hello I cannot using the node form while my two paintings of indexing.  I'm getting "NaN" for my output array. I think that the problem lies in my shift register.  My guess is that for the first calculation is not a PreviousAngle is why it gives me "

  • How to restore the original win7 Home premium after it has been deleted

    I have HP Pavilion dv6 with windows7 home premium, I removed windows and recovery files. How to restore original windows and the recovery partition that I got from the factory?