Page 1 of 1

Tree view widget - assign labels to non-leaf nodes?

Posted: Sat Jan 14, 2017 7:18 pm
by Fjord
Hi,
I'm experimenting with a tree view widget; there are some things I can't find a way to do. Help appreciated. Livecode 8.1.0.
If I do

Code: Select all

   put "first label" into p[1]
   put "second label" into p[2]
   set the arrayData of widget "tv" to p
I get both labels; but if I do

Code: Select all

   put "first label" into p[1]
   put "second label" into p[2]
   put "first sublabel of second label" into p[2][1]
   put "second sublabel of second label" into p[2][2]
   set the arrayData of widget "tv" to p
I lose the "second label".
Question 1: how can I have a label for a node that has subnodes?
Question 2: is there a way to display only the labels, not the indices which are irrelevant to the user, still retaining the triangles?
By the bye: why is it, if I delete the last subnode of a node, the latter still has a triangle which is now useless?

Re: Tree view widget - assign labels to non-leaf nodes?

Posted: Sun Jan 15, 2017 1:23 am
by bn
Hi François,

do you mean something like this:

Code: Select all

on mouseUp
   put "" into p["first label"]
   put "" into p["second label"]
   put "" into p["second label"]["first sublabel of second label"]
   put "Data1" into p["second label"]["first sublabel of second label"]
   put "" into p["second label"]["second sublabel of second label"]
   put "Data2" into p["second label"]["second sublabel of second label"]
   set the arrayData of widget "tv" to p
end mouseUp
By the bye: why is it, if I delete the last subnode of a node, the latter still has a triangle which is now useless?
I think that is a bug.

Kind regards
Bernd

Re: Tree view widget - assign labels to non-leaf nodes?

Posted: Sun Jan 15, 2017 2:07 pm
by Fjord
Thank you Bernd!!
In my mind, I was focusing on what you call data and wanted to ignore the keys. But I understand; the hierarchy is in the keys and your example opened my [mind's] eyes.