Tree view question

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Fjord
Posts: 132
Joined: Sat Dec 06, 2008 6:18 pm
Location: France

Tree view question

Post by Fjord » Wed Nov 01, 2023 9:12 pm

Hi,
I'm using a Tree View control to display a tree structure but I'm running into a problem: data can be associated with tree 'leaves' but [apparently] not to tree 'nodes'. Just to make myself clear:

Code: Select all

   put "1" into p["first label"]
   put "2" into p["second label"]
   put "2.1" into p["second label"]["first sublabel of second label"]
   put "2.2" into p["second label"]["second sublabel of second label"]
   set the arrayData of widget "tv2" to p
gives the following tree
Image
So, the line with 'second label' with data = 2 does not appear. Also, I can get an 'actionDoubleClick' message when I click on the leaves (#1, 2.1 & 2.2) but not on #2
Attachments
Screenshot 2023-11-01 à 20.59.09.png
--
François

Fjord
Posts: 132
Joined: Sat Dec 06, 2008 6:18 pm
Location: France

Re: Tree view question

Post by Fjord » Wed Nov 01, 2023 9:15 pm

(cont'd)
I want to associate data to the nodes (like '2). Did I miss something? or is it impossible with the widget Tree View? meaning I would have to design my own solution with a field.
--
François

bwmilby
Posts: 441
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Tree view question

Post by bwmilby » Thu Nov 02, 2023 1:31 am

You are not missing anything. The sub-array is the value. You can’t have both a scalar value and a sub-array value.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

Post Reply

Return to “Talking LiveCode”