I ran into the same tree text formatting issue as you. At the end, I used
this.treeitem.text.setAttribute( "fontstyle", "bold" );
as in the sample code here, which sets normal fontstyle for leaf nodes and bold fontstyle for nonleaf nodes on tree init.
<canvas>
<dataset name="dsTree">
<node name="Branch 1">
<node name="Leaf 1" isleaf="true"/>
<node name="Leaf 2" isleaf="true"/>
</node>
<node name="Branch 2">
<node name="Leaf 3" isleaf="true"/>
<node name="Leaf 4" isleaf="true"/>
</node>
<node name="Branch 3">
<node name="Leaf 5" isleaf="true"/>
<node name="Leaf 6" isleaf="true"/>
</node>
</dataset>
<simplelayout axis="x"/>
<tree datapath="dsTree:/" text="$path{'@name'}" showroot="false" open="true">
<tree datapath="*" text="$path{'@name'}" isleaf="$path{'@isleaf'}" open="true">
<handler name="oninit">
var isLeaf = this.datapath.getNodeAttribute( "isleaf" );
if ( isLeaf )
this.treeitem.text.setAttribute( "fontstyle", "normal" );
else
this.treeitem.text.setAttribute( "fontstyle", "bold" );
</handler>
</tree>
</tree>
</canvas>
Hope this helps.
Yong Yee
On 9/21/06, James Howe <[EMAIL PROTECTED]> wrote:
I did find a way to get this to work, but it's not what I would call
ideal. I need to do the following:
this.treeitem.subviews[2].setAttribute("fontstyle", "bold");
Is there a more direct way to access the view which displays the text of
the tree?
Thanks!
On Thu, 21 Sep 2006 16:36:07 -0400, "James Howe"
<[EMAIL PROTECTED]> said:
> [...]
>
> This code works just fine. Now I'm trying to use a tree instead of a
> list/textlist item. I've got the code working where it is attempting to
> set the fontstyle to either bold or plain, but the visual result is
> always plain. Initially I just tried doing this:
>
> this.setAttribute("fontstyle", "bold")
>
> where 'this' is an instance of 'tree'. I then inspected the tree object
> and found that it holds on to a treeitem. So then I tried:
>
> this.treeitem.setAttribute("fontstyle", "bold");
>
> Again, no luck.
>
> [...]
--
James Howe
[EMAIL PROTECTED]
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user
_______________________________________________ Laszlo-user mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-user
