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
Contributor
snarasimhan
Posts: 24
Registered: ‎08-04-2010
My Device: Not Specified
Accepted Solution

Can TreeFields contain Images?

Hi all,

 

I wanted to know if TreeFields can contain Images..? As in, on Expansion it should show up an Image., is that possible?

 

Or is there any other class that provides a similar functionality? 

 

Thanks,

Suhas

Please use plain text.
Contributor
snarasimhan
Posts: 24
Registered: ‎08-04-2010
My Device: Not Specified

Re: Can TreeFields contain Images?

I figured it out myself! Treefields can hold Images! :smileyhappy:

 

Now my question is, can we have different Row Heights for parent and child nodes?

how can we implement that if possible?

 

Thanks in advance!

 

Suhas

 

Please use plain text.
Developer
Ted_Hopp
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: Can TreeFields contain Images?

[ Edited ]

You can certainly draw an image in a TreeField row, just like you can with a ListField. You implement this in your TreeFieldCallback.drawTreeItem() method. There are lots of threads on doing this with a ListField. Search the forum--the techniques apply equally to a TreeField.

 

But a TreeField has the same limitations as a ListField: all rows must be the same height. I suspect that may rule out using a TreeField for what you want to do.

 

[Edit: I see that while writing this, you figured out the first part already.]




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Please use plain text.
Contributor
snarasimhan
Posts: 24
Registered: ‎08-04-2010
My Device: Not Specified

Re: Can TreeFields contain Images?

@ Ted

 

Yeah! thats exactly the problem I'm facing right now!

 

any suggestions as to what I could use instead of TreeFields??

 

Thanks,

Suhas

 

Please use plain text.
Developer
Ted_Hopp
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: Can TreeFields contain Images?

You can fake it all. Use buttons or labels for the top-level rows. When a particular button is clicked, the manager can dynamically insert or delete a BitmapField following the button. It can also tell the button to flip its appearance between "expanded" and "collapsed" states.

 

To get the buttons to look like you want, you may find this sample code from RIM interesting:

Implement advanced buttons, fields, and managers




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Please use plain text.
Contributor
snarasimhan
Posts: 24
Registered: ‎08-04-2010
My Device: Not Specified

Re: Can TreeFields contain Images?

Okay, thanks a lot!

 

I was just trying to see if we had any class that could provide the functionality! :smileyhappy:

 

 

Please use plain text.