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
spring_suvarna
Posts: 330
Registered: ‎02-25-2009
My Device: Not Specified
Accepted Solution

How to display Horizontal and Vertical scrollbar with arrows

[ Edited ]

Hello,

 

I have few rows and few columns in my application. Number of columns and rows are more. In order to display next column or next row, we need to nevigate in respective direction (left , right, up ,down). I am successful in doing so.

 

BUT, now i want to show the scroll bars with ARROWS. and i am not able to show them.

 

Need help.

 

Thanks in advance.

 

Message Edited by spring_suvarna on 03-17-2009 04:07 PM
Please use plain text.
Developer
jhaehnle
Posts: 238
Registered: ‎08-26-2008
My Device: Not Specified

Re: How to display Horizontal and Vertical scrollbar with arrows

Hi,

 

i'm not quite sure, but you should paint these arrows by yourself if not painted by system fields....

Therefor you have to detect if field or whatever is visible and at last position (horizontally on bottom)

and so on....

 

Regards,

Jochen

Please use plain text.
Developer
spring_suvarna
Posts: 330
Registered: ‎02-25-2009
My Device: Not Specified

Re: How to display Horizontal and Vertical scrollbar with arrows

how should i paint?

 

any suggestions?

Please use plain text.
Developer
spring_suvarna
Posts: 330
Registered: ‎02-25-2009
My Device: Not Specified

Re: How to display Horizontal and Vertical scrollbar with arrows

Hey guys got a solution for Horizontal Scrollbar arrows

 

HorizontalFieldManager hfmScrollbar; hfmScrollbar=new HorizontalFieldManager(){ protected void sublayout(int maxwidth,int MaxHeight){ setExtent(FIELD_WIDTH,20); } public void paint(Graphics g){ g.setColor(Color.BLACK); g.drawRect(0,0,FIELD_WIDTH,20); int lxPts[] = {5, 15, 15}; int lyPts[] = {10,5,15}; int rxPts[] = {FIELD_WIDTH-5,FIELD_WIDTH-15,FIELD_WIDTH-15}; int ryPts[] = {10,5,15}; g.drawFilledPath(lxPts, lyPts, null, null); g.drawFilledPath(rxPts, ryPts, null, null); super.paint(g); } };

 

will post the code for Vertical Scroll bar as soon as i am succeeded in it
Please use plain text.
Developer
spring_suvarna
Posts: 330
Registered: ‎02-25-2009
My Device: Not Specified

Re: How to display Horizontal and Vertical scrollbar with arrows

Here is the code snippet for Vertical Scroll bar

 

 

vfmScrollbar=new VerticalFieldManager(){; protected void sublayout(int maxWidth,int maxHeight){ setExtent(20,160); } public void paint(Graphics g){ g.setColor(Color.BLACK); g.drawRect(0,0,20,160); int uxPts[]={5,10,15}; int uyPts[]={15,5,15}; int dxPts[]={5,10,15}; int dyPts[]={145,155,145}; if(currentRow>7) g.drawFilledPath(uxPts, uyPts, null, null); if(totalRows>8 && currentRow<totalRows) g.drawFilledPath(dxPts, dyPts, null, null); super.paint(g); } };

 

 

 

Please use plain text.
Developer
luisfernando
Posts: 91
Registered: ‎11-24-2009
My Device: Storm

Re: How to display Horizontal and Vertical scrollbar with arrows

Hey guys,

 

that code indeed is paiting the arrows but also is paiting everything else. I add some fields to the horizontalfieldmanager(bitmaps) and when the paint method is called everything dissapears.

 

Can the paint method be called before adding elements?

Is there any way to prevent horizontalfieldmanager fields get painted?

 

 thanks

-Luis Fernando

Remember to give Kudos(click on the star at your left) if this helped you.
Click on "Accept Solution" if the problem is resolved.
Espanol? Escribeme un mensaje privado.
Please use plain text.
Developer
luisfernando
Posts: 91
Registered: ‎11-24-2009
My Device: Storm

Re: How to display Horizontal and Vertical scrollbar with arrows

Hi,

 

Problem solved,

 

I use super.subpaint(g);

 

instead of paint(g);

-Luis Fernando

Remember to give Kudos(click on the star at your left) if this helped you.
Click on "Accept Solution" if the problem is resolved.
Espanol? Escribeme un mensaje privado.
Please use plain text.