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
omri
Posts: 74
Registered: ‎07-17-2008
My Device: Not Specified
Accepted Solution

Scroll on the vertical field manager in popup

Hey everyone,I'm having a problem with scrolling on my popup dialog with VerticalFieldManager.

 

I inherited from PopupScreen, and gave it a VerticalFieldManager in the constructor.

 

it was constructed with the styles

VERTICAL_SCROLL | VERTICAL_SCROLLBAR | DOWNWARD

 

Now, In the manager i put 2 label fields.

When the second field is bigger then the space i have on the screen, i still cant scroll the display.

 

Any ideas of why this happends?

Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Scroll on the vertical field manager in popup

[ Edited ]

In the VFM you could override the sublayout() method. First you would call super.sublayout() followed by setExtent(). Set the extent to the desired viewable width and height.

 

That along with having VERTICAL_SCROLL in the style should allow for scrolling.

Message Edited by mreed on 08-17-2008 01:59 PM
Developer
omri
Posts: 74
Registered: ‎07-17-2008
My Device: Not Specified

Re: Scroll on the vertical field manager in popup

[ Edited ]

Is there a way to do this on the PopupScreen level?

i want it to scroll on the entire PopupScreen space

like with MainScreen.

 

I tried your way as well,

like this

 

            super(new VerticalFieldManager(VERTICAL_SCROLL | VERTICAL_SCROLLBAR)
            {
                protected void sublayout(int width, int height)
                {
                    super.sublayout(width, height);
                    setExtent(width, height);
                };
            }, DEFAULT_CLOSE);

 

still didnt work.

any idea? 

Message Edited by omri on 08-17-2008 03:38 PM
Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Scroll on the vertical field manager in popup

[ Edited ]
sublayout() is going to receive the maxWidth and maxHeight, but that is usually not what we want to use for the extent when scrolling. The extent gets set in super.sublayout() with whatever is passed to super, so we want to reset it with something smaller.
Message Edited by mreed on 08-17-2008 03:28 PM
Developer
omri
Posts: 74
Registered: ‎07-17-2008
My Device: Not Specified

Re: Scroll on the vertical field manager in popup

but this is the extend i want

i want max width and max height, as i want the popup screen to scroll.

 

Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Scroll on the vertical field manager in popup

[ Edited ]

Think of a manager as a viewport... if the extent is as tall as the combined contents it holds (maxHeight), then there won't be any scrolling for it to do (even if it does not fit onto the screen). If the extent is the maxHeight, then whatever is holding it needs to enable VERTICAL_SCROLL instead.

 

Looking back, I have one question, in your first post did you add those styles to the VFM or the PopupScreen.

 

Message Edited by mreed on 08-17-2008 05:03 PM
Developer
omri
Posts: 74
Registered: ‎07-17-2008
My Device: Not Specified

Re: Scroll on the vertical field manager in popup

In my first post i tried both

none of them worked.

 

I think that the maxWidth and maxHeight are caped by the display size, if i build the manager popupscreen without the VERTICAL_SCROLL param.

 

can you show me how you would do it?

 

the thing is the extent is smaller then the actual size of the fields.

i even see the arrow for the scroll bar.

it just wont scroll... 

Developer
omri
Posts: 74
Registered: ‎07-17-2008
My Device: Not Specified

Re: Scroll on the vertical field manager in popup

This is the entire class I'm talking about.

i do see the arrow for the scrollbar going down, but i cant scroll... 

 

    class CViewData extends PopupScreen
    {
        CViewNote(CData data)
        {
            super(new VerticalFieldManager(VERTICAL_SCROLL | VERTICAL_SCROLLBAR)
            {
                protected void sublayout(int width, int height)
                {
                    super.sublayout(width, height);
                    setExtent(width, height);
                };
            }, DEFAULT_CLOSE);
            LabelField lblCaption = new LabelField(data.getCaption() + ": ");
            LabelField lblData = new LabelField(data.toString());
           
            add(lblCaption);
            add(new SeparatorField());
            add(lblData);
        }
    }

Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Scroll on the vertical field manager in popup

Okay. Try sending the FOCUSABLE style to your LabelFields.
Developer
omri
Posts: 74
Registered: ‎07-17-2008
My Device: Not Specified

Re: Scroll on the vertical field manager in popup

Tried that, still didnt scroll.

(BTW, i dont want them to be focusable, but thats a diffrent issue)

 

Thanks for your help mreed.