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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
bwei
Posts: 26
Registered: ‎07-14-2008

How to implement a variable-height ListField?


I need to make a customed ListField which has variable height rows

for example

1  This is first row of the list  

     line1:

     line2

2  This is second row of the list    

    line1

    line2

    line3

3 This is second row of the list  

    line1

.......
 

Thanks very much for your help.


bwei
Please use plain text.
Developer
rafo
Posts: 507
Registered: ‎07-15-2008

Re: How to implement a variable-height ListField?

There is no way, except of creating your own ListField implementation.
----------------
if your issue solved set "Solution" mark at the relevant post
Please use plain text.
Developer
Developer
rab
Posts: 283
Registered: ‎07-22-2008

Re: How to implement a variable-height ListField?

You can use  the method: setRowHeight(index, rowHeight); to set row heights.

 

Most of my ListFields are customized by extending the  ObjectListField.

The setRowHeight() can be called during the  drawListRow() or when you add elements ... (depending on your app)

 

 

Rab

 

Please use plain text.
Developer
bwei
Posts: 26
Registered: ‎07-14-2008

Re: How to implement a variable-height ListField?

Hi Rab,

 

Thanks very much.

 

I know the following method which sets the height of each row in the list field.

public void setRowHeight(int rowHeight)

 It looks like setRowHeight(index, rowHeight) is undocument method.I am wondering if it is safe to use this method. 

Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
My Carrier: Bell

Re: How to implement a variable-height ListField?

Methods not listed in the JavaDocs should not be used.  These methods can change or be removed at any time.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Please use plain text.
Developer
simon_hain
Posts: 13,817
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: How to implement a variable-height ListField?

the native mail application uses this function to resize the list elements if you set the font size to a high value.
----------------------------------------------------------
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
Please use plain text.
Developer
KarlH
Posts: 29
Registered: ‎09-12-2008

Re: How to implement a variable-height ListField?

My doc version (Blackberry JDE 4.3.0 API Specification) documents that method, so is it an older version that doesn't document it, or is it removed in a newer version?
Please use plain text.
Developer
peter_strange
Posts: 17,712
Registered: ‎07-14-2008

Re: How to implement a variable-height ListField?

Interesting, my 4.3 JDE does not include it....

 

Can you paste in the javadoc description for us all to have a look at?

Please use plain text.
Developer
KarlH
Posts: 29
Registered: ‎09-12-2008

Re: How to implement a variable-height ListField?

file:///C:/Program%20Files/Research%20In%20Motion/BlackBerry%20JDE%204.3.0/docs/api/index.html

 

net.rim.device.api.ui.component
Class ListField

java.lang.Object
|
+--net.rim.device.api.ui.Field
|
+--net.rim.device.api.ui.component.ListField

All Implemented Interfaces: AccessibleContext, IComponent, InputMethodListener, VariableRowHeightProvider

Direct Known Subclasses: ObjectListField

 

...clip...

 

setRowHeight

public void setRowHeight(int rowHeight)

Sets the height of each row in the list field.

 

Parameters: rowHeight - Height of each row in the list field. Specifying ROW_HEIGHT_FONT will use the height of the font for this field. If this parameter is negative, it indicates the row height is in multiples of the height of the font for this field.

Throws: IllegalArgumentException - If invalid row height parameter (if zero, or too small proper display of current font).

 

 

Am I just lucky, or what??

Please use plain text.
Developer
simon_hain
Posts: 13,817
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: How to implement a variable-height ListField?

that's the standard method.
the interesting one is setRowHeight(index, rowHeight), which allows to set the height of each row independantly.
and it is not documented, as so many helpful features.
----------------------------------------------------------
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
Please use plain text.