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
New Contributor
ganeshkumarrr
Posts: 9
Registered: ‎04-04-2011
My Device: 9550

How to enable scrolling

Hi, 

I have created a class which when we give a set of array it will draw the custom list and add to the corresponding screen, in the screen i have a vertical field manager with color and scrolling are enabled, when i add up to 8 item which displays inside the vertical field manager i can able to scroll, but when the array gives above that limit the items are drawn beyond the verical field manager and i cant able to scroll. the items which are drawn beyond the vertical field manager has no background color. Please help me...

 

Thanks in advance

 

GM

Please use plain text.
Developer
jprofitt
Posts: 604
Registered: ‎12-27-2010
My Device: Not Specified

Re: How to enable scrolling

Can you post some of the code that you're using here? There could be a number of reasons why this is happeneing and it would probably be easier if we could just look at what you're doing.

Please use plain text.
New Contributor
ganeshkumarrr
Posts: 9
Registered: ‎04-04-2011
My Device: 9550

Re: How to enable scrolling

ya sure
Please use plain text.
New Contributor
ganeshkumarrr
Posts: 9
Registered: ‎04-04-2011
My Device: 9550

Re: How to enable scrolling

 

Hi the coding is very large, 
the class which draw the list extends the horizontal field manager and the constructor will get the parameter and draw the list, 
the class which we are drawing the list will pass the array to the container constructor and draw the list in the particular screen, 
code snippet :

        VerticalFieldManager internalManager = new VerticalFieldManager( Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR) {

         public void paintBackground( Graphics g ) {
                g.clear();
                int color = g.getColor();
                //g.setColor( 0x5A5A5A );
                g.setColor( 0x232323 );
                g.fillRect( 0, 0, DeviceOrientation.getRealDisplayWidth(), DeviceOrientation.getRealDisplayHeight() );
//                g.fillRect(0, 0, getWidth(), getHeight());
                g.setColor( color );
            }
            
            protected void sublayout( int maxWidth, int maxHeight ) {
                int displayWidth = DeviceOrientation.getRealDisplayWidth();
                int displayHeight = DeviceOrientation.getRealDisplayHeight();
    
                super.sublayout( displayWidth, displayHeight );
                setExtent( displayWidth, displayHeight );
            }
            
            public void paint( Graphics g ) {
             g.setColor(Color.WHITE);
             super.paint(g);
            }
        };
above this vertical field manager only i m adding the items.  when the item size exceeds, the bg color is not present and scrolling also not present,  better i like to show only 7 items and after that i want to display the remaining items in the array, how can i pass the value to draw the list? or i need to enable the scrolling for all the items in the array which are drawn.
Thanks

 

Please use plain text.
New Contributor
ganeshkumarrr
Posts: 9
Registered: ‎04-04-2011
My Device: 9550

Re: How to enable scrolling

I have 30 list of items and i should only display the 7 items to the user for visible and after scrolling the rest of the items to be displayed. Using the vertical field manager, how can i do it?

Thanks
Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various

Re: How to enable scrolling

You already have scrolling, but your paintBackground is wrong. The first two parameters of fillRect should be

g.fillRect(getHorizontalScroll(), getVerticalScroll(), ...)

 

Right now, when you scroll to the items off-screen, they are white on white background - that's why you don't see them.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.