Scrolling BasicEditField

Hello

I want to create a BasicEditField with a fixed width, and the text entered must be vertical scrolling in this area.

Here is my code.

BasicEditField befield= new BasicEditField("World: ","")
{
      public int getPreferredWidth()
      {
         return Display.getWidth();
      }

      public int getPreferredHeight()
      {
         return 50;
      }

      public void layout(int width, int height)
      {
          super.layout(width, getPreferredHeight());
          setExtent(width, getPreferredHeight());
      }
 };

VerticalFieldManager vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLL|Manager.VERTICAL_SCROLLBAR);
vfm.add(befield);
this.add(vfm);

I expect this code to display a BasicEditField of size 50 and the entered text must be scroll in the box. The text entered after the 50 height is not visible.

Should what changes I make.

THQ.

I think that this example allows you to get close to what you are looking for.

Pimp My object: create a TextBox field

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

Tags: BlackBerry Developers

Similar Questions

  • BasicEditField cursor scroll Position up vs down

    Hi everyone: the screen of the application has BasicEditField 5

    Before submitting the data, the user wants to change one of the entries.

    When scrolling to the TOP with the trackball, the cursor appears AFTER THE LAST tank in the field.

    When scrolling down with the trackball, the cursor appears at the FIRST tank in the field.

    This inconsistancy causes new users make mistakes - is - it possible to have it behave the same both ways?

    Thank you.

    Thank you Rex:

    I used xxxxxxxxxxxxxxx.setCursorPosition (0) is the name of this particular and 0 BasicEditField the offset xxxxxxxxxxxxxxx

    instead of BasicEditField... setCursorPosition()

    Now it works the same go upwards or downwards

  • Adding scrolling Horizantal to Custom textField

    Hello

    I wrote a BasicEditField to measure

    How to add horizantal scroll to this custom field...?

    I added the following, but the text does not appear...

    HFM HorizontalFieldManager = new HorizontalFieldManager (Manager.HORIZONTAL_SCROLL |) Manager.NO_HORIZONTAL_SCROLLBAR);
    CustomTextField c1 = new CustomTextField ("Enter1:", "", 100, EditField.FILTER_DEFAULT |) EditField.FIELD_LEFT, 200);
    HFM. Add (C1);
    Add (HFM);

    Please find my custom here class

    SerializableAttribute public class CustomTextField extends BasicEditField
    {
    private int labelWidth;
    public CustomTextField (label As String, String initialValue, int maxNumChars, long style, int fieldWidth)
    {
    Super (label, initialValue, maxNumChars, style);
    labelWidth = getFont () .getAdvance (label);
    this.fieldWidth = fieldWidth;
    }
    public int getPreferredWidth()
    {return fieldWidth ;}
    public int getPreferredHeight()
    {return super.getPreferredHeight () ;}
    protected void layout (int width, int height)
    {
    width = getPreferredWidth();
    height = getPreferredHeight();
    Super.Layout (width, height);
    super.setExtent (width, height);
    }
    protected void drawFocus (graphics graphics, boolean on)
    {super.drawFocus(graphics, on) ;}
    protected void paint (Graphics graphics)
    {
    int w = getWidth();
    int h = getHeight();
    graphics.drawRect (labelWidth, 0, (o-labelWidth), h);
    Super.Paint (Graphics);
    }
    }

    Can you please provide a way to add the scroll horizantal bar at this by displaying the text correctly.

    Thanks in advance

    Please take a look at the developer following the journal article.  He's an example of what you're trying to accomplish.

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

  • Horizontal scrolling TextFields custom

    Hello friends. I am trying to create a textfield that automatically scrolls horizontally when the field is full. I use a custom class of TextField shown below which I reduced for simplicities sake. I have also included the call that I use. Any ideas why it would not produce a scrolling textfield horiztontally? Thanks to all lots of love.

    Create a new TextField in a HorizontalFieldManager

    HorizontalFieldManager mgrFirstName = new HorizontalFieldManager (HORIZONTAL_SCROLL);

    FirstName TextField = new TextField (BasicEditField.NO_NEWLINE, HORIZONTAL_SCROLL);

    mgrFirstName.add (FirstName);

    Add (mgrFirstName);

    / * Class TextField custom * /.

    SerializableAttribute public class TextField extends HorizontalFieldManager

    {

    public BasicEditField bEdit = null;

    Public TextField (long Style, long scrolling)

    {
    Super (Scroll);

    bEdit = new BasicEditField (Style);
    Add (bEdit);

    }

    }

    Here is a link to an article in the knowledge base that solves this problem. If you want to spruce up the gadget, make sure to read the comments:

    A scrolling line text entry field

  • Kaleidoscope fields Center, buttom, and auto-scrolling.

    Hi, I have a few questions of gui.

    1. How can I align an ActiveRichTextField down and towards the center of the window?

    using setstatus works for Kaleidoscope downstairs, but if the user sets the font for large print screen it covers other areas above and don't watch not unworthy of them.

    2. How can I horizontallty Center a BasicEditField?  I read that he uses the entire width and therefor cannot be centered.

    3 How do the scrollable mainwindow only when the fields are out of the window and not scroll when fields have enough space inside the window? Currently, he lets me scroll even if all fields are displayed in the window.

    I have these problems because I want to support the different sizes and different screen resolutions.

    1. How can I align an ActiveRichTextField down and towards the center of the window?

    using setstatus works for Kaleidoscope downstairs, but if the user sets the font for large print screen it covers other areas above and don't watch not unworthy of them.

    @ - I suspect that you set style as no bar scroll (horizontally and vertically) in your screen. setStatus will always allocate area for your field of status at the bottom of your screen and will not give other managers or component. Status area can be extended, based on the height of your domain. To overcome that, set no scroll bars (horizontally and vertically) style on the screen, so that the status field will be set in low and other components/managers scrolls, if they are not able to adapt to the screen.

    2. How can I horizontallty Center a BasicEditField?  I read that he uses the entire width and therefor cannot be centered.

    -Yes, native BasicEditField uses the entire width of the screen. to overcome it, as a custom field and substitute getPrefferedWidth() and specify the width that you want to give to this field, override layout() like this

    public void layout (int width, int height)

    {

    Super.Layout (width, height);

    setExtent (getPreferredWidth(), height);

    }

    and also to set the style for this field as FIELD_HCENTER

    3 How do the scrollable mainwindow only when the fields are out of the window and not scroll when fields have enough space inside the window? Currently, he lets me scroll even if all fields are displayed in the window.

    @ until you have not set all styles to scroll (horizontally and vertically) bars on your screen. It will be managed by the default screen

    I think, this will be useful for you

  • Tab of the static Menu on the scrolling of the list

    I have 4 legs, and I have a list. The list is scrollable, I want tho... scrolling tabs above to stay and to scroll just through the list?

    How can I fix my code?

    package mypackage;
    
    import java.util.Vector;
    
    import net.rim.device.api.system.EncodedImage;
    import net.rim.device.api.ui.DrawStyle;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FocusChangeListener;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.BasicEditField;
    import net.rim.device.api.ui.component.BitmapField;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.component.SeparatorField;
    import net.rim.device.api.ui.component.Status;
    import net.rim.device.api.ui.container.HorizontalFieldManager;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    public class TabControl extends MainScreen implements FocusChangeListener {
    
            private LabelField tab1;
    
            private LabelField tab2;
    
            private LabelField tab3;
    
            private LabelField tab4;
    
            private LabelField spacer1;
    
            private LabelField spacer2;
    
            private LabelField spacer3;
    
            private VerticalFieldManager tabArea;
    
            private LabelField tab1Heading;
    
            private BasicEditField tab1Field1;
    
            private BasicEditField tab1Field2;
    
            private LabelField tab2Heading;
    
            private BasicEditField tab2Field1;
    
            private BasicEditField tab2Field2;
    
            private LabelField tab3Heading;
    
            private BasicEditField tab3Field1;
    
            private BasicEditField tab3Field2;
    
            private BasicEditField tab4Field1;
    
            private BasicEditField tab4Field2;
    
            private LabelField tab4Heading;
    
            private VerticalFieldManager tab1Manager;
            private VerticalFieldManager tab2Manager;
            private VerticalFieldManager tab3Manager;
            private VerticalFieldManager tab4Manager;
            private int catId = 0;
            public TabControl(int id) {
                catId = id;
                HorizontalFieldManager hManager = new HorizontalFieldManager();
                tab1 = new LabelField("Top20", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_SELECT);
                tab2 = new LabelField("Artists", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_SELECT);
                tab3 = new LabelField("History", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_SELECT);
                tab4 = new LabelField("Tab 4", LabelField.FOCUSABLE | LabelField.HIGHLIGHT_SELECT);
                spacer1 = new LabelField(" | ", LabelField.NON_FOCUSABLE);
                spacer2 = new LabelField(" | ", LabelField.NON_FOCUSABLE);
                spacer3 = new LabelField(" | ", LabelField.NON_FOCUSABLE);
    
                tab1.setFocusListener(this);
                tab2.setFocusListener(this);
                tab3.setFocusListener(this);
                tab4.setFocusListener(this);
                hManager.add(tab1);
                hManager.add(spacer1);
                hManager.add(tab2);
                hManager.add(spacer2);
                hManager.add(tab3);
                hManager.add(spacer3);
                hManager.add(tab4);
    
                add(hManager);
                add(new SeparatorField());
                tab1Manager = new VerticalFieldManager();
                tab2Manager = new VerticalFieldManager();
                tab3Manager = new VerticalFieldManager();
                tab4Manager = new VerticalFieldManager();
    
                tabArea = displayTab1();
                add(tabArea);
    
            }
    
            public void focusChanged(Field field, int eventType) {
                if (tabArea != null) {
                    if (eventType == FOCUS_GAINED) {
                        if (field == tab1) {
                            System.out.println("Switch to Tab 1");
                            delete(tabArea);
                            tabArea = displayTab1();
                            add(tabArea);
                        } else if (field == tab2) {
                            System.out.println("Switch to Tab 2");
                            System.out.println("Switch to Tab 1");
                            delete(tabArea);
                            tabArea = displayTab2();
                            add(tabArea);
                        } else if (field == tab3) {
                            System.out.println("Switch to Tab 3");
                            System.out.println("Switch to Tab 1");
                            delete(tabArea);
                            tabArea = displayTab3();
                            add(tabArea);
                        }
                        else if (field == tab4) {
                            System.out.println("Switch to Tab 3");
                            System.out.println("Switch to Tab 1");
                            delete(tabArea);
                            tabArea = displayTab4();
                            add(tabArea);
                        }
                    }
                }
    
            }
    
            public VerticalFieldManager displayTab1() {
    
                Vector v0 = new Vector();
                MAMClient.getTop20(v0, catId);
                SingersListField listField = new SingersListField(v0);
                listField.setSelectedIndex(-1);
                listField.setSize(v0.size());
    
            tab1Manager.deleteAll();
                tab1Manager.add(listField);
                return tab1Manager;
            }
    
            public VerticalFieldManager displayTab2() {
                if (tab2Heading == null) {
                    tab2Heading = new LabelField("Password Recovery");
                    tab2Manager.add(tab2Heading);
                }
                if (tab2Field1 == null) {
                    tab2Field1 = new BasicEditField("Security Question: ", "Mother's Maiden Name?");
                    tab2Manager.add(tab2Field1);
                }
                if (tab2Field2 == null) {
                    tab2Field2 = new BasicEditField("Password: ", "");
                    tab2Manager.add(tab2Field2);
                }
                return tab2Manager;
            }
    
            public VerticalFieldManager displayTab3() {
                if (tab3Heading == null) {
                    tab3Heading = new LabelField("Interests");
                    tab3Manager.add(tab3Heading);
                }
                if (tab3Field1 == null) {
                    tab3Field1 = new BasicEditField("Hobbies: ", "");
                    tab3Manager.add(tab3Field1);
                }
                if (tab3Field2 == null) {
                    tab3Field2 = new BasicEditField("Memberships: ", "");
                    tab3Manager.add(tab3Field2);
                }
                return tab3Manager;
            }
            public VerticalFieldManager displayTab4() {
                if (tab4Heading == null) {
                    tab4Heading = new LabelField("Registration");
                    tab4Manager.add(tab4Heading);
                }
                if (tab4Field1 == null) {
                    tab4Field1 = new BasicEditField("Username: ", "");
                    tab4Manager.add(tab4Field1);
                }
                if (tab4Field2 == null) {
                    tab4Field2 = new BasicEditField("Password: ", "");
                    tab4Manager.add(tab4Field2);
                }
                return tab4Manager;
            }
        }
    

    I solved it now

    Yes, you do the first floating and other horizontalmanager scrolling.

    but in the constructor of your form, you must specify this too
    Super(NO_VERTICAL_SCROLL |) NO_VERTICAL_SCROLLBAR);

  • Cannot scroll down after the substitution object based on the LabelField?

    As the title says, I have replace the LabelField paint function to set the color of the text in red, but when I add it to the screen, so that it can not scroll down see other content below that doesn't have space to display.

    My program is like this:

    final String labelText = «...» » ;

    LabelField overageField = new LabelField (labelText) {}
    protected void paint (Graphics g) {}
    g.setColor (Color.RED);
    g.drawText (labelText, 0, 0);
    Super.Paint (g);
    }
    };

    Add (overageField);

    In addition, I have to add to my code? Any suggestion will be appreciated. Thanks in advance.

    I tried something like that in my screen, no problem to scroll down.

     LabelField lf = new LabelField("BBDeveloper")
            {
                public void paint(Graphics g)
                {
                    g.setColor(0xFF0000);
                    g.drawText("BBDev",200,0);
                    super.paint(g);
                }
            };
            add(lf);
            BasicEditField bef = new BasicEditField("Test1: ","Test2");
            add(bef);
            RichTextField rtf = new RichTextField("Test3");
            add(rtf);
    
  • Highlight BasicEditField instead of wrap

    When you type in a BasicEditField, if the entry goes beyond its width she will wrap text to the next line.  Is it possible to get it to scroll the text of entry overflowing off to the left instead?  TIA.

    Sweet.  Who did.  I've had it a VerticalFieldManager another reason so it was an easy passage.  The good thing is that we don't have even to substitute the provision since it gets so many as an available due to being in a HFM scroll width.  Thank you!

    HorizontalFieldManager hfm = new HorizontalFieldManager(Manager.HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR);
    
    BasicEditField bef = new BasicEditField();
    hfm.add(bef);
    
    add(hfm);
    
  • My wireless mouse works fine everywhere except in Mail. It is simply not to scroll or work at all.

    My wireless mouse works fine in all applications except Mail, where it does not at all. It is altogether we els and absent when I try to use it either as a pointer to a specific e-mail or use it to scroll. It simply is not there. What gives?

    Please could you tell us what operating system you are using.   It isn't iOS with an iMac.

  • Trackpads only 2 fingers scrolling on the Mac Mini

    I have two Magic trackpad (wireless), a couple of years; No will 2 fingers scrolling on my Mac Mini (try them for the first time on the Mini). both work fine on my other machines.  All machines are updated to the latest version of El Capitan, a lot of RAM.  Same settings trackpad on all machines.  The movement of the cursor trackpad, highlighting, click Select OK on the Mini, but no two fingers scrolling, without pinching to resize.  Have not checked all the possibilities, but lack of scrolling is a deal breaker.  Track pad update 1 is too old, have not found another.  Tried with mouse wireless on and outside.  A run first aid.  Reinstalled the system software.  Even enabled the scrolling options, the settings of the mouse.  Help!

    If two of your machines running El Capitan and touchpads are version 1 of Trackpad, it is probably the reason.   While versions more old mouse and trackpad will work to some extent, all the features with El Capitan requires the version of Magic Trackpad 2.   The MT2 has developed especially for El Capitan and later operating systems.   I know that it's a nuisance, but the new trackpad is levied directly on your machine and needs no battery.

  • Unable to scroll upwards or downwards with the iPhone iOS 10 6 s more

    With any screen with my iso 10, it is difficult to move or scroll. Is there an adjustment for this?

    It's the same thing with the home screens, it is difficult to move to the next set of icons or just

    scroll up and down with safari.

    Thank you

    Bill

    This has been fixed with orders to "hold time."

  • The scrolling behavior is not smooth after update to Mac OS Sierra

    After that the macOS update Sierra the scrolling behavior has changed, does anyone have same experiences?

    I can still scroll trough a Web page without a problem. I mean the scroll with 2 fingers on the touch pad or scroll with the magic mouse gesture.

    BUT: In trying to slowly scroll through long lists of selections, just answers touching on fast movements, not on the slow change.

    Steps to reproduce:

    Open a Web site like twitter and go to preferences. Go to the time zone list, open it, and scroll through it. Can you move the cursor to line by line?

    You can also move to http://www.doyouspain.com/mietwagen/ , select a country like the Spain a try to SLOWLY scroll list.

    (I just discovered: the list of operating system at the end of this page shows the same problems with PCMCIA)

    I found this behavior using "Parallels Desktop". I can't scroll the documents most as before the update.

    Hello!

    Please open the accessibility, to increase the scrolling speed move the slider from slow to fast (from left to right).

    A screenshot for reference.

    Thank you!

  • Scrolling problem

    I have the scrolling problem in netbeans IDE in my macBook pro early 2015 (retina 13 inches), somewhere that is extremely fast cannot see what is happening and in a place more slowly scrolling and not able to fix by increase or decrease scrolling speed of the trackpad in

    sys.pref-> accessibility.

    Everyone please help.

  • Why not with the work of the fingers to scroll after upgrading to the Sierra?

    I can't scroll with two fingers on the trackpad once I upgraded to Sierra. Any tips?

    Hello!

    Please open trackpad and check the meaning of natural area scroll.

    Thank you!

  • two fingers scrolling down does not work

    After the upgrade to OS Sierra my Macbook air (2015) trackpad scroll (two fingers) does not work. Please provide a solution. Thank you

    MacBook Air (13 inch, early 2015), OS X El Capitan (10.11.1)

    It took a little time, but I found a solution.

    1. In System Preferences, open accessibility.
    2. Use your keyboard to scroll down on the left side of the mouse and Trackpad.
    3. Click the Trackpad button.
    4. Uncheck scroll and click OK.
    5. Click the Trackpad button.
    6. Scroll to check again, and then click OK.
    7. Check that this set.

    It worked for me. Good luck to you!

Maybe you are looking for