Set the hilited of node...

This is a forum focused on providing support for rTree

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Locked
Clarkey
Posts: 109
Joined: Fri Jun 11, 2010 11:10 am
Location: UK

Set the hilited of node...

Post by Clarkey » Wed Jun 01, 2011 8:00 am

Hi Mats,
I am using an rTree for outline navigation (think of 'folders') and a data grid (think of folder contents, which can include folders).

When the user selects a rTree node, the dgData of the data grid will be set to a data set. This can be triggered through the hilitedNodeIDs of the rTree (as long as this list has only one entry, as raised in http://forums.runrev.com/phpBB2/viewtop ... =51&t=7857

However, when a user selects a row in the data grid, I need to set the hilite of the corresponding rTree node (and expand the node's parents to make it visible) but the following syntax doesn't seem to set the node hilite...

set the hilited_of_node_ID_[2] of control "Tree" to true

What is the correct syntax to achieve this - or is this a feature request?
Best,
Keith..

wilstrand
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 114
Joined: Mon Jan 03, 2011 3:02 pm
Contact:

Re: Set the hilited of node...

Post by wilstrand » Wed Jun 01, 2011 8:36 am

Hi Keith!

Thank you for the description of what you are doing! It is always nice to have examples of how rTree is used and the combination with the Data Grid is a good one!

To hilite one or more nodes you use the hilitedNodeIDs property of the rTree control. The hilited property of a node is read only. This is consistent with the hilitedLines property of a field control in LC (you can not set the hilited of a line). So to accomplish what you need you could do something like this:

Code: Select all

on mouseUp
   set the itemDelimiter to slash
   repeat for each item tPathID in the IDpath_of_node_ID_[theNodeID] of me
        set the expanded_of_node_ID_[tPathID] of me to true
   end repeat
   set the itemDelimiter to comma
   set the hilitedNodeIDs of me to theNodeID
   dispatch "renderTree" to me
end mouseUp
All the best
Mats
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects

Clarkey
Posts: 109
Joined: Fri Jun 11, 2010 11:10 am
Location: UK

Re: Set the hilited of node...

Post by Clarkey » Wed Jun 01, 2011 9:05 am

Hi Mats,
Glad you like this use case for rTree. This is a commercial product development and I intend to show my app in a future livecode.tv LiveCode live coding event (but there's a lot to do before then!).

Thanks for the code snippet for expanding the path to a specific node. That has saved me some head-scratching. :D

Thanks also for the clarification on the hilited property. The intent behind this requirement to 'set' the node hilite is really only cosmetic - to show the user that the focus of the combined rTree/datagrid navigation system has changed. Is it possible to set the fill colour of the node so that it appears to be highlighted (the user would know no different)?
Best,
Keith..

wilstrand
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 114
Joined: Mon Jan 03, 2011 3:02 pm
Contact:

Re: Set the hilited of node...

Post by wilstrand » Sun Jun 05, 2011 6:23 pm

Hi Keith

About setting the fill colour of the node so that it appears to be highlighted:
This is a planned feature for rTree 2.0.

Best regards
Mats
http:www.tapirsoft.on-rev.com
Open Source LiveCode Plugins - rIDE, rGrid, rTree
LiveCode projects

Clarkey
Posts: 109
Joined: Fri Jun 11, 2010 11:10 am
Location: UK

Re: Set the hilited of node...

Post by Clarkey » Sun Jun 05, 2011 8:15 pm

Hi Mats,
Thanks for the heads-up.
FYI, I was able to spoof the appearance of a hilite by using 'set the hilited line' of the container field.
Best,
Keith..

Locked

Return to “rTree”