Scrolling VerticalFieldManager

Hello

I've added an image to a VerticalFieldManager:

_Manager = (VerticalFieldManager) getMainManager () VerticalFieldManager;
Borders XYEdges = new XYEdges (20, 20, 20, 20);
Border = BorderFactory.createBevelBorder (edges);
_manager.setBorder (border);

and then I added a RichTextField:

_manager. Add (new RichTextField());

When I discovered the text in the RichTextField, and I need to scroll vertically, I can't do the 40 background pixels, I think because of the frame (20 + 20 = 40).

For example, if I need to scroll of 600 pixels, I can only scroll 560.

Does anyone know how to fix this?

Thank you!


Tags: BlackBerry Developers

Similar Questions

  • Fixed scrolling verticalfieldmanager in verticalfieldmanager of size?

    Hello

    I want to verticalfieldmanager scrollble in a verticalfieldmanager (screen size) of a fixed size.

    I tried sublayout to set the size to fix it works but the inner verticalfield Manager does not show all areas it contains. (not completely scrollble).

    I put a picture with envy of .and size fixed verticalfieldmanager (external) that all fields must be scrolling in internal verticalfieldmanager.

    can someone help me how can reach that.

    You add your mainManager on a screen?  If so, make sure that your screen is not scrolling.

    In addition:

    You make too much extra stuff in your code while missing a few key points:

    (1) adds the USE_ALL_HEIGHT and USE_ALL_WIDTH style to your mainManager bits;

    (2) delete the substitution of sublayout mainManager;

    (3) use getWidth() and getHeight() instead of 480 and 360 in your call drawBitmap;

    (4) replace paint in the mainManager with paintBackground and drop super.paint appeal from there;

    (5) remove your override of sublayout() of your innerManager - regularly VerticalFieldManager with VERTICAL_SCROLL and possibly VERTICAL_SCROLLBAR is all you need.

    (6) label your buttons in some way to distinguish between them, something like

    BTN [i] = new ButtonField ("button #" + (i + 1), ButtonField.FOCUSABLE);

    Navigate via the buttons and see if the screen scrolls.

  • ListField Scrolling - please help!

    I have read many comments scrolling ListField and I have

    a hard time!

    Trying to get the scroll for a ListField. It is in a VerticalFieldManager.

    The ListField is the contents of a table like structure. The BitmapFields

    on the left you see below, are a different Manager.

    The manager that contains a scrolling VerticalFieldManager

    and scroll to the WIDE bars.

    Start photo:

    NOTE the arrow the down scroll bar here, no arrow (?). But I'm at the top of the list, I want to scroll to the top to see the bottom. There are 30 entries in this list. This is a problem.

    After scrolling:

    I do not understand why scrolling results in the image above.

    Where is my top scroll bar arrow?

    In addition, after scrolling once, I lose the arrow of the scroll bar.

    Ideas?

    Here's the drawRow in my ListView:

    I realized what was going on.

    Field.getExtent () does not return a copy of the rectangle of the measurement field - but the rectangle extent itself.

    So, if you have

    XYRect r = this.getExtent ();

    r.x += factor;

    Then your field will be repainted in the wrong place. It will be a wrong x.

    I think it is a bug or bad design, because this measure rectangle should be wrapped.

    You cannot modify it via the interface of the method, you should not be able to change this way.

    getExtent() should return a copy of this rectangle, in my opinion.

    So I was something with measurement values, calculation without realizing that I was changing the coordinates of the field.

    My ListField wasn't all scrolling. It has simply been moved downwards.

    Unfortunately, it still does not scroll.

    lucidbee.

  • Screen with fixed and content header drop-down

    Hello

    as written in the subject,

    -J' created a screen with NO_VERTICAL_SCROLL.

    -added display a field, for example a button as a header.

    -created a verticalFieldManager with VERTICAL_SCROLL,

    -added fields to the verticalManager

    - and the verticalManager added to the screen.

    The problem is that nothing passes.

    I followed the steps posted here

    http://supportforums.BlackBerry.com/T5/Java-development/create-a-screen-with-stationary-headings/TA-...

    but without success.

    Can someone help me?

    Found the problem!

    Scroll VerticalFieldManager I did not USE_ALL_WIDTH, so clicking on the side right (empty) of the screen, the fields, put on the left don't scroll down.

  • Only a VerticalFieldManager in scroll screen

    Hello

    I have a class that extends the screen. This screen contains a HorizontalFieldManager with a nested VerticalFieldManager. The VerticalFieldManager is set to scroll. I want to do the VerticalFieldManager with scrolling to the point where the VerticalFieldManager is the ONLY thing that scrolls. Currently, the entire screen will scroll.

    I was able to do this successfully by the extension "PopupScreen" instead of "Screen" and to the specification in the constructor:

    super(new VerticalFieldManager(NO_VERTICAL_SCROLL | NO_VERTICAL_SCROLLBAR),Field.FOCUSABLE);
    

    However, it is not good, because I need to use the setStatus() method, which I believe is that by extending the screen accessible.

    Is there anyway that I can achieve everything by extending the screen and having access to setStatus()?

    Thank you!

    Solved with super (NO_VERTICAL_SCROLL);

  • VerticalFieldManager no scroll bar

    In my application, I have two different cases where my VerticalFieldManager scrolls, but it will not show scrollbars. Here is the code I have them during initialization.

    private VerticalFieldManager manager = new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.VERTICAL_SCROLL | VerticalFieldManager.VERTICAL_SCROLLBAR);
    

    Any ideas? I don't understand why they will not be displayed

    Thank you

    I thought about it!

    It was then that I had a VerticalFieldManager who took the entire screen (called primary), which has been initialized without scrolling, I didn't actually call super (Manager.NO_VERTICAL_SCROLL).

    So if someone else came here with the same problem, I couldn't have my managers children to display a scroll bar, until I have called great (Manager.NO_VERTICAL_SCROLL), even if the elements I wanted to scroll in a manager who had NO_VERTICAL_SCROLL to define.

    Thank you arkadyz for the help anyway.

  • VerticalFieldManager and scrolling

    I have a VerticalFieldManager that I use to set up a scroll pane. My intention is to have the component DO NOT scroll until enough lines are added to the need for scrolling. Currently, as soon as I add an element (a HorizontalFieldManager) for the optimization of resources, the scroll arrow appears and I can scroll the only existing line out of sight, and I don't want that to happen.

    I tried the example found here:

    http://supportforums.BlackBerry.com/T5/Java-development/implementing-a-standard-style-scrollbar-on-a...

    This example does not work for me, the custom scroll bar never shows up, and I get the same behavior by default VFM.

    Can someone tell me how to do the VFM not scroll until the visible part is full?

    Thank you!

    I found through debugging that by default, the height that was passed into it was a BFN (big freaking number), so he always thought the display size has been less than real estate available (so no need to scroll). I changed my builders to spend in the area that has been assigned by the Manager of container, and the scroll bar appears and the behavior is reasonable.

    One last question, I still seem to get the default value of scroll arrows, and it is not clear to me if (as in the example), they are supposed to be there or not. The constructor calls super() with NO_VERTICAL_SCROLLBAR, but they always appear.

  • VerticalFieldManager with a fixed size: scroll issue

    Hello

    I try to have a full screen UI in a fix header (some fields Manager) and a scrollable (a list of custom field) content. The idea is to emulate a kind of drop-down list.

    To do this, I made a custom VerticalFieldManager that accept a maxHeight (the screen height - the height of the header).

    I had the following problems:
    -The scroll arrows are not displayed (never)
    -On OS 4.7 (Storm), I can scroll further down that last point to have nothing on my screen, but the header.

    My code need to compile with the JDE 4.2.1 & 4.7 and running on Pearl and storm. (at least I might have two versions of this class)

    I suspect that the two problems are related. I probably do something wrong. I looked at a few example/forum and always find a similar solution.
    Can Guys tell me what I did wrong?

        /**
         *  custom class, so we can set a max height (to keep the header visible)
         */
        class InvVerticalFieldManager extends VerticalFieldManager{
        private int maxHeight = 0;
    
        InvVerticalFieldManager(int _maxHeight){
          super(
           //this provoc an "empty scrollable zone" on Storm
           // but if you don't put it, on other OS, the vertical manager does not scroll at all.
           Manager.VERTICAL_SCROLL
    
           | Manager.VERTICAL_SCROLLBAR
           );
          maxHeight = _maxHeight;
        }
    
        protected void sublayout(int width, int height){
                super.sublayout(width, getPreferredHeight());
                setExtent(width, getPreferredHeight());
        }
    
        public int getPreferredWidth() {
            return Graphics.getScreenWidth();
        }
    
        /**
         * allow the manager to use all the given height. (vs auto Height)
         */
        public boolean forceMaxHeight = false;
        public int getPreferredHeight() {
          if (forceMaxHeight) return maxHeight;
          int m = super.getPreferredHeight();
          if (m > maxHeight) m = maxHeight;
          return m;
        }   
    
        ////////////////////////////////////////////////////////////////////////////
    
        protected boolean isUpArrowShown(){
          //TODO: does not seem to work (4.2.1 emulator & 4.5 device). (called with good return value but the arrows are not painted)
          int i = getFieldWithFocusIndex();
          //Trace("isUpArrowShown " + i);
          return i > 0;
          // note: algo not correct, cause the up arrow will be visible event when no field are hidden.
          //       but not so bad, so the user "know" that he can go up.
        }
    
        protected boolean isDownArrowShown(){
          int i = getFieldWithFocusIndex();
          return i < getFieldCount();
        }
    
        ////////////////////////////////////////////////////////////////////////////
        // note : since 4.6 you can use
        // http://www.blackberry.com/developers/docs/4.6.0api/net/rim/device/api/ui/decor/Background.html
    
        public int myBackgroundColor = 0xffffff;
        protected void paint(Graphics g){
            g.setBackgroundColor(myBackgroundColor);
            // Clears the entire graphic area to the current background
            g.clear();
            super.paint(g);
        }
    
        }
    

    any help is welcome.

    I got it!

    the solution to add the header as raw material and the other the field in a factory of value for money. BUT, you must call 'super (NO_VERTICAL_SCROLL)' in the constructor of the form.

  • VerticalFieldManager will not scroll long LabelField?

    Hello

    I have a VerticalFieldManager. I add a LabelField unique to it. His text is long, so it spills over the bottom of the screen. My application shows that there is more text with the vertical scroll arrows. However, it will not scroll down. The same layout with a bunch of buttons works fine, scrolling works without problem.

    Is there something special we have to do for long LabelFields, for its parent VerticalFieldManager to scroll?

    Thank you

    Substituting LabelField RichTextField, that's what I need.

    Thank you

  • ListField (s) nested in VerticalFieldManager-&gt; SWIPE/SCROLL with HorizontalFieldManager

    I have 2 ListField objects. Each within its own VerticalFieldManager object. 2 VFMs are inside a HorizontalFieldManager object. I am trying to allow the user to BLOW/scrolling of one ListField to another (LEFT/RIGHT). I did not have the TouchEvent portion this again (I guess I'll have to put in place something there).

    Here's what I have so far... However, only the first ListField shows with data (random numbers right now). The other is empty. I also want to allow the user to select individual lines in each ListField

    All the suggestions/help is appreciated.

    See you soon,.

    public final class MyScreen extends MainScreen {
    
        public MyScreen() {
            super(MyScreen.NO_VERTICAL_SCROLL);
            Random rand = new Random();
            HorizontalFieldManager hm = new HorizontalFieldManager(HorizontalFieldManager.HORIZONTAL_SCROLL);
            Vector v1 = new Vector();
            Vector v2 = new Vector();
            for (int i = 0; i < 10; i++) {
                v1.addElement(Integer.toString(rand.nextInt(200)));
                v2.addElement(Integer.toString(rand.nextInt(300)));
            }
            hm.add(new ListManager(v1, "VM lf1"));
            hm.add(new ListManager(v2, "VM lf2"));
            add(hm);
    
            // Set the displayed title of the screen
            setTitle("MyTitle");
    
        }
    
        class ListManager extends VerticalFieldManager {
            private Vector _elements;
            ListField _lf;
    
            ListManager(Vector elements, String title) {
                super(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR);
                _lf = new ListField();
                _lf.setCallback(new ListCallback());
                this._elements = elements;
                add(new RichTextField(title));
                add(_lf);
                updateList();
            }
    
            private class ListCallback implements ListFieldCallback {
    
                public void drawListRow(ListField list, Graphics g, int index, int y, int w) {
                    g.setColor(Color.BLACK);
                    String text = (String) _elements.elementAt(index);
                    g.drawText(text, 5, y, 0, w);
                }
    
                public Object get(ListField list, int index) {
                    return _elements.elementAt(index);
                }
    
                public int indexOfList(ListField list, String p, int s) {
                    return _elements.indexOf(p, s);
                }
    
                public int getPreferredWidth(ListField list) {
                    return Display.getWidth();
                }
            }
    
            protected void sublayout(int width, int height) {
                super.sublayout(width, height);
    
                setExtent(width, height);
            }
    
            private void updateList() {
                _lf.setSize(_elements.size());
            }
    
        }
    }
    

    The two lists show up... However, the halves just in the same HM. My goal is to have everyone take full screen (visible at the time) only... then the user has to SWIPE (from EAST to WEST) to see the list of the other.

    So I changed the following line

    super.sublayout(Display.getWidth(), height);
    

    Thanks Peter

  • How to use touch gesture to scroll the ObjectListField in a VerticalFieldManager?

    My subclass of ObjectListField is added to a VerticalFieldManager. On a trackball device elements scroll upward and down fine.

    However, on a storm (touchscreen device), the list does not scroll when you move your finger upward or toward the bottom of the screen. How scroll the list vertically on a storm? Thank you.

    Found the problem...

    Trying to develop for touch and non touch, I got a subclass of the screen which was the touchEvent() substitution.

  • VerticalFieldManager resets the scroll on focus

    I expanded a VerticalFieldManager to manage the scroling and it works well.

    But I have a problem OnFocus

        protected void onFocus(int direction)
        {
            super.onFocus(direction);
            setVerticalScroll(scrollPosition);
        }
    

    When the manager gets the focus sets the vertical slider to 0.

    I checked the value in my method and it is correct.

    How to get around this behavior?

    Thank you very much.

    try to wrap your call in an invokelater

  • How to improve the search function on a VerticalFieldManager that contains custom managers

    I have a screen with a VerticalFieldManager for a list of custom managers holding.

    The screen also contains an EditField that behaves like a search field, when the user enters the text, my app looping through an array of custom managers and compares the text entered with the text of all managers in the table.

    If the text of a Manager matches the input string, I add this handler to the VerticalFieldManager.

    Here are the relevant parts of my code:

    EditField _editField.
    TempBeanPlaces [] _placesList;
    VerticalFieldManager _vfmCellPlaces;

    ....

    This is the constructor of TemBeanPlaces:

    public TempBeanPlaces (String pPlaceName, CellPlaceManager pCellPlaceManager) {}
    placeName = pPlaceName;
    cellPlaceManager = pCellPlaceManager;
    }
    ...

    And this code handles the research:

    _editField.setChangeListener (new FieldChangeListener() {}
    ' Public Sub fieldChanged (field field, int context) {}
    String text = _editField.getText () .toLowerCase ();
    _vfmCellPlaces.DeleteAll ();
    for (int i = 0; i)< _placeslist.length;="" i++)="">
    TempBeanPlaces tempBeanPlaces = _placesList [i];
    If (tempBeanPlaces.getPlaceName () .toLowerCase (). IndexOf (Text)! = -1) {}
    _vfmCellPlaces.Add (tempBeanPlaces.getCellPlaceManager ());
    }
    }
    updateLayout();
    }
    });

    This works well when the _placesList table is not too big (length of 50, for example), otherwise the application becomes too slow.

    How can I optimize my code for large quantities of custom managers? For example, in the case, the table contains 600 elements.

    I really need to improve this feature. I just read on the ListField in BlackBerry, but since I have this code, maybe I need to rewrite all with ListFields.

    Thanks in advance!

    The biggest problem with update fields as it is time to layout, fields that are added.  If you add such a moment, then each addition will cause a layout.  Instead, you use addAll to add an array of items, or you can also add all of your items to a single Manager, and then add the Manager.  Then the layout occurs only once.

    In your code, the option would be to add managers selected to a vector, transform the vector into an array, then use addAll.

    You don't need the updateLayout().

    That said, more you add them fields, more processing will be available anyway, then perhaps you are trying to add more elements than even this optimization will execute quickly.  If this optimization does not work enough, then you will need to look in a different way, say 'paging' results, then the display doesn't show that the top 25 and the user can 'add more '.  This 'Exchange' is a good approach in my experience, because users will rarely scroll 25, when they can make another research that could give them better results.

    Finally, and to be on par with the comment of Simon, ListField is an extremely effective area because it is a unique field, so layout is easy, and he's not trying to paint lines until they are actually displayed on the screen.  So in your case, you have three options:

    (1) addAll

    (2) paging

    (3) ListField

    Let us know how you go.

  • problem with verticalfieldmanager?

    _vmanager[0]=new VerticalFieldManager();
             row[0]=new HorizontalFieldManager();
            _lablefield[0]=new CustomLableFeild("Account No:");
            _vmanager[0].add(_lablefield[0]);
            _vmanager[0].add(new CustomManager(0));
            _lablefield[25]=new CustomLableFeild("(If Applicable)");
            _vmanager[0].add(_lablefield[25]);
            row[0].add(_vmanager[0]);
            row[0].add(new SpacerField(0,0));
            _vmanager[1]=new VerticalFieldManager();
            _textbox[0]=new TextBoxField(118,28);
            _vmanager[1].add(_textbox[0]);
            row[0].add(_vmanager[1]);
    

    I am trying to add textfield for this account only, but it did not add.

    pls help me if anyone knows?

    He could have added. If either CustomLableFeild or CustomManager uses the full display width, then _vmanager [0] uses the full display width. In this case, the rest of the fields of _row [0] is positioned beyond the right edge of the screen. Without horizontal scrolling, it's almost as if these fields were not there.

    What classes CustomLableFeild and CustomManager extend? What style value when they are built?

  • Background image of display and scrolling VFM

    Right now, I'm stuck trying to give the desired result work on my screen. I already know the basics of adding a background to a Manager (value bit flags USE_ALL_WIDTH and USE_ALL_HEIGHT so that paint void). However, I must also deal with a child growable VFM attached to the screen can scroll if the height is greater than the height the screen less the height of the top banner field. What I want to achieve is the following: having a screen that does not scroll with a background image that is attached to the dimensions of the screen less field height of the banner (first low-level with the BG Manager). However, I want the VFM child to be able to scroll if necessary while the BG image is displayed in the background. Here's what I have so far to my constructor:

    public MyMainScreen(){
       super( NO_VERTICAL_SCROLLBAR );
       VerticalFieldManager myVFM = new VerticalFieldManager(
                                    VerticalFieldManager.USE_ALL_WIDTH
                    | VerticalFieldManager.NO_HORIZONTAL_SCROLL
                    | VerticalFieldManager.NO_VERTICAL_SCROLLBAR
                    | VerticalFieldManager.FIELD_TOP
                    | VerticalFieldManager.TOPMOST
                    | VerticalFieldManager.BOTTOMMOST );
       setBanner(myBannerField);
       //fields are added to VFM.....
    
       VerticalFieldManager bgManager = new VerticalFieldManager(
                                    VerticalFieldManager.USE_ALL_WIDTH
                                    | VerticalFieldManager.USE_ALL_HEIGHT
                                    | VerticalFieldManager.NO_VERTICAL_SCROLL){
               public void paint(Graphics g){
                  //my BG gets drawn here...
                  super.paint(g);
               }
       };
       bgManager.add(myVFM);
       add(bgManager);
    }
    

    So, I just need to know if I'm doing something wrong here. Of course, it may be obvious to some, but for some reason that I'm completely stumped. Thanks in advance.

    Tried again without the substitution of sublayout, and he managed to work given my VFM populating routines, because the domain in question (HFM) that is updated is added without all the fields added initially, so my VFM has all the fields, it needs at that point to have himself. You're right, if I wanted to complex me and choose to place the fields of optimization of resources on particular points, it would be wise to replace sublayout and define to what extent, accordingly, but in this case, it works fine without it. Anyway, the people, the answer today is that your screen does not scroll by setting super (NO_VERTICAL_SCROLLBAR |) NO_VERTICAL_SCROLL) in the constructor, however, if you want the custom vertical scrolling on your VOR with BG, you must set to vertically, do scroll down and use the height by passing the following style bits:

    VerticalFieldManager.USE_ALL_WIDTH
    | VerticalFieldManager.NO_HORIZONTAL_SCROLL
    | VerticalFieldManager.VERTICAL_SCROLL
    | VerticalFieldManager.NO_VERTICAL_SCROLLBAR
    | VerticalFieldManager.USE_ALL_HEIGHT

    then you replace paintBackground appeal of this optimization of the resources any desired call paint and that's it.

Maybe you are looking for