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
ipcTony
Posts: 107
Registered: ‎08-08-2008
My Device: Not Specified
Accepted Solution

Non-scrolling section in screen that extends MainScreen

I'm trying to figure out how to put a non scrolling section at the top of a screen that extends my applications MainScreen.

 

 

final class ListScreen extends MainScreen implements ListFieldCallback
{

 

    private ListField _itemListField;         
    private LabelField listHeader;
 

    public ListScreen()
    {                  

         newScreen = new MainScreen(MainScreen.NO_VERTICAL_SCROLL | Manager.HORIZONTAL_SCROLL);

 

        // from the example

        HorizontalFieldManager columnHeadingHolder = new HorizontalFieldManager(HorizontalFieldManager.NO_HORIZONTAL_SCROLL
            | HorizontalFieldManager.NO_VERTICAL_SCROLL | HorizontalFieldManager.USE_ALL_WIDTH);

                 

          columnHeadingHolder.add(listHeader);

 

        VerticalFieldManager dataScroller = new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL
            | VerticalFieldManager.VERTICAL_SCROLLBAR);

         

         dataScroller.add(_itemListField);
    }

}

 

The problem i have is the screen is white but if I click the trackwheel the menu pops and when i close the menu the screen finally is displayed.

 

Tried several methods to extend the mainscreen but can't seem to get just right.

 

Please use plain text.
Developer
jonberry
Posts: 484
Registered: ‎07-17-2008
My Device: Not Specified

Re: Non-scrolling section in screen that extends MainScreen

setTitle won't work for you?

 

Jon

Please use plain text.
Developer
ipcTony
Posts: 107
Registered: ‎08-08-2008
My Device: Not Specified

Re: Non-scrolling section in screen that extends MainScreen

um yes it would but I was hoping to have table headers like so:

 

Title would be my search field

 

Description    Price

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

scrolling items here

 

 

anyway to get this to work?

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Non-scrolling section in screen that extends MainScreen

You can still use setTitle.  Instead of adding a Field, add a Manager with your Headers in it. 

 

This works fine for me, but there is a 'border' between the title area and the scrolling portion, that varies depending on OS level, and you might not like the look of it. 

 

If that doesn't work, then the one way I know is to add a fixed height VerticalFieldManager to the main part of the MainScreen - with the Height fixed so that it fills the part of the screen you have left after your title and headers.  But when I've been playing round with that, I can't get the scrollbars to appear.  Probably a Style thing I haven't set properly.  Following is a sample that restricts the height to a maximum of 3 lines.  This code only works for one line Fields as I'm sure you will figure out from the code.

 

VerticalFieldManager vfm = new VerticalFieldManager(Manager.VERTICAL_SCROLLBAR | Manager.VERTICAL_SCROLL) { int maxHeight = this.getFont().getHeight() * 3; public int getPreferredHeight() { return this.getFont().getHeight() * this.getFieldCount(); } protected void sublayout(int width, int height){ super.sublayout(width, height); setExtent(width, Math.min(maxHeight, this.getPreferredHeight())); } };

 

Please use plain text.
Developer
ipcTony
Posts: 107
Registered: ‎08-08-2008
My Device: Not Specified

Re: Non-scrolling section in screen that extends MainScreen

Thank you peter and "jonberry" now i know what you meant about using the Title area. I didn't know I could add more than one field in the title. and now that I know its possible I can use peter's recommendation of adding a manager. this should be find for this project.

 

thanks again.

Please use plain text.