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
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve
My Carrier: compny

How to add manager in list rowfield

Hi every one 

 

  I want to add a verticalFieldManager (with background image and Labelfield over that), in each row of list field.

And also i need to add click event on label field which is on manager.

 

 so can any one give me some idea.

 

Thanks.

Developer
Posts: 16,750
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to add manager in list rowfield

in a listfield you draw each row yourself using graphics.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve
My Carrier: compny

Re: How to add manager in list rowfield

Hi simon

 

 can you help me a little example code.

 

thanks.

Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to add manager in list rowfield

Following is some code from this Thread:

http://supportforums.blackberry.com/t5/Java-Development/Adding-static-button-in-a-Scrollable-list/td...

 

public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width) {

int columnWidth = width/NUMBER_OF_COLUMNS_TO_DISPLAY;

  

int xpos = 0;

// First column test data supplied from program

String suppliedData = (String) this.get(listField, index);

graphics.setColor(Color.BLACK);

graphics.drawText(suppliedData, xpos, y);

xpos +=  columnWidth;

// Dummy up the other columns.....

graphics.setColor(Color.RED);

for ( int i = 1; i < NUMBER_OF_COLUMNS_TO_DISPLAY; i++ ) {

graphics.drawText("c" + Integer.toString(i), xpos, y);

xpos +=  columnWidth;

}

}

 

This code simply displays text at various positions along the row.  Your requirement is probably similar, so you need to choose which paint method you use depending on what you want to paint.  for example, if you want an image, then you will need to find that image, and the position it in the row, and then paint the image.  Then you need to decide where you want the text to go, so you will probably find out how wide the image is, and position your text to the right of that.

 

One 'trick' you need to be aware of is setting the height of your ListField row.  See the ListField API documentation for this method and see the Graphics class for methods you can use to paint your row.

 

Give this a go and come back with specific questions. 

 

There are many examples of ListFields if you look around.  It is not a trivial Field to use or to explain, so be prepared to spend some time reviewing and trying things.  But it is a very powerful and high performing Field, so I recommend its use.

 

Good luck.