How to get a hilitedElement value from a Tree View's arrayData?

J. Landman Gay jacque at
Mon Dec 20 15:46:25 EST 2021

I'm confused about what the goal is. The hilitedElement contains the text of the selection. The 
array is already in place, so you don't really need to add to it.

The reason you're seeing text in the message box is because the last line contains an 
unspecified "put". Without a destination for the "put" it will go automatically to the message 
box. If you want to work with it, you'd need to put the value into a variable.

What's the purpose of the concatenation, and what do you want to do with the selection?

On 12/20/21 11:11 AM, Keith Clarke via use-livecode wrote:
> Hi folks,
> I’m struggling to access the value from a Tree View widget’s data array as the hilitedElement changes - though I think my issue is more about working with arrays than the Tree View widget.
> The following test script (on the Tree widget) successfully gets the Tree’s arrayData into tTreeData and creates a ‘correct-looking’ nested array key syntax for any changing tHilitedElement.
> However, the last line displays the tHilitedElement variable string in the message box rather than concatenating it to tTreeData as the nested key to return the element’s value.
> on hiliteChanged
> put the hilitedElement of me into tHilitedElement
> if char -1 of tHilitedElement is comma then delete char -1 of tHilitedElement
> replace comma with quote & "][" & quote in tHilitedElement
> put "[" & quote before tHilitedElement
> put quote & "]" after tHilitedElement
> put the arrayData of me into tTreeData
> put tTreeData & tHilitedElement
> end hiliteChanged
> I’ve tried various forms of brackets around the tHilitedElement variable containing the nested key string with no success - what am I doing wrong?
> TIA.
> Best,
> Keith
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

Jacqueline Landman Gay         |     jacque at
HyperActive Software           |

More information about the use-livecode mailing list