Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 157
Registered: ‎03-03-2009
My Device: Not Specified
Accepted Solution

A question about sublayout

I extended VerticalFieldManager and added multiple fields into the manager. What puzzels me is that if I provide a sublayout function as below, only 7 added fields are displayed and scrolled. If I do not provide the sublayout function, as many fields and I have added can be displayed and scrolled. Could anyone spot what's wrong with the following?

 

public void sublayout(int width, int height){
        int x = 0;
        int y = 2;
        Field field;
        int numberOfFields = getFieldCount();
        for (int i=0; i<numberOfFields; ++i) {
            field = getField(i);
            layoutChild(field, width, height);
            setPositionChild(field, x, y);
            y += field.getPreferredHeight() + 1;
        }
       
        setExtent(Math.min( width, getPreferredWidth()), Math.min( height, getPreferredHeight()));
    }

Developer
Posts: 157
Registered: ‎03-03-2009
My Device: Not Specified

Re: A question about sublayout

The code was run on Storm OS4.7.0.75
Highlighted
Developer
Posts: 56
Registered: ‎07-14-2008
My Device: Not Specified

Re: A question about sublayout

I'm not looking at my code but I seem to recall the function was "setVirtuallExtent" or something like that to indicate how big the scrollable area should be.
Developer
Posts: 157
Registered: ‎03-03-2009
My Device: Not Specified

Re: A question about sublayout

That worked. Thanks!