08-25-2010 01:44 AM
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?
Solved! Go to Solution.
08-25-2010 02:18 AM
I figured it out myself! Treefields can hold Images!
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!
08-25-2010 02:21 AM - edited 08-25-2010 02:22 AM
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.]
08-25-2010 02:36 AM
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: