BlackBerry Forums Support Community               

Closed Thread
LinkBack Thread Tools
Old 04-14-2009, 05:37 PM   #1 (permalink)
New Member
Join Date: Apr 2009
Model: 9000
Carrier: vodafone
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Screen custom paint. How to show scrollbars?

Please Login to Remove!

hi all,
in a screen i override paint function to design screen's content as i like. The matter is that the height of the content painted inside the screen exceed display max height and the vertical scrollbar is missing.
code is simple... for example
protected void paint(Graphics graphics) {
for ( int i = 0; i < 100; i++ ) {
graphics.drawText("test", 5, y + ( i * 30 ), DrawStyle.ELLIPSIS );

how can i force the vertical scrollbar to be displayed?

next step is more complex. i need to add a button at the bottom of the screen. how can this be solved?

please post code

Last edited by ichigo72 : 04-14-2009 at 06:03 PM. Reason: added a question
Old 04-14-2009, 07:29 PM   #2 (permalink)
BlackBerry Extraordinaire
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts

If you paint your own screen, then you'll be responsible for the scroll bars and the scrolling.

Instead, extend Field (creating your own custom field), do your painting inside the Field class. Now you can add your Field to a Manager and set the SCROLL properties in the manager. The Manager will scroll your field if the field vitual extent exceeds the display area.

Your next step is really a variation of this first. Set the physical extent of your Field so that it will not encroach on the area reserved for the button.

And BTW, post on one forum or the other, not both.

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.