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: 52
Registered: ‎11-03-2008
My Device: Not Specified

Multi Column List View

Hi,

 

Could anyone please help me on this. I want to have a multi-column list view control in my blackberry form; just like a ListView control in .NET applications development.

 

I tried using ObjectListField but I am not able to succeed.

 

 

Thanks

- Arun

BlackBerry Development Advisor
Posts: 15,723
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Multi Column List View

The BlackBerry API set doesn't contain any built in field that displays muli column lists.  You could create a series of columns using managers.  Have a look at the screen used in this sample for an example.

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800625/How_To_...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 12
Registered: ‎11-12-2008
My Device: Not Specified

Re: Multi Column List View

A number of the apps that come with the Blackberry--notably the mail reader--show what appears to be tabular data with multiple columns. It would be very helpful if you could tell us how the Blackberry engineers implement that. What do they do to get the columns lined up and to truncate long items with the ellipses? How do they get icons into a column?

 

As someone who comes from Java SE programming (where the standard components automatically take care of these tedious details), it is a bit unclear how much can be obtained from the BB components and how much must be hand-coded. 

 

Thanks,

 

Cay

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

Re: Multi Column List View

I suspect the majority of the applications that you are thinking of use ListField.  You can tell a ListField because the entire row is selected when you scroll down to it.  It is not possible to select a 'cell' in that row, though it does look like there is tabular data because the columns line up.

 

With ListField, there is a drawListRow method that gets called with an index (index to the entry that should be drawn) and a graphics 'rectangle' into which it can be drawn.  This method can do what it likes in here, so for example, can decide to display some data starting at pixel position 100 in the x axis - this is how you get what looks like tabular data.

 

So to use this control, you need to understand the methods that are available to draw stuff onto a Graphic rectangle.

 

Look for examples on this forum and elsewhere of using ListField.

 

As quick examples consider the following:

 

graphics.drawText(aString, 0, y, (DrawStyle.LEFT + DrawStyle.ELLIPSIS + DrawStyle.TOP), 200 );

// Draw the String starting on the left hand side (position 0) for a maximum of 200 pixels

// Give the String an ellipsis if it is too long

 

graphics.drawBitmap(200, y, icon.getWidth(), icon.getHeight(), icon, 0, 0);

// Draw the icon at x position 200