Collapse and expand Tree View Widget from code

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

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
vincitygialam
Posts: 1
Joined: Tue Sep 11, 2018 3:46 am

Collapse and expand Tree View Widget from code

Post by vincitygialam » Tue Sep 11, 2018 4:18 am

Anybody know how to collapse a treeview widget with code?
I want to reset a treeview widget for users from within the code?
Would be even better if I had full control over what part to expand and collapse.

Regards,

Quda

bwmilby
Posts: 197
Joined: Wed Jun 07, 2017 5:37 am
Location: New Orleans, LA
Contact:

Re: Collapse and expand Tree View Widget from code

Post by bwmilby » Mon Sep 17, 2018 1:25 am

Currently there isn't a way to change the fold state from code.
Brian Milby

Script Tracker https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 452
Joined: Fri Feb 06, 2015 4:03 pm

Re: Collapse and expand Tree View Widget from code

Post by LiveCode_Panos » Mon Sep 17, 2018 11:45 am

You could try the following - it is not very efficient, but seems to work.

1. Find the location of the arrow you want to click so as as to expand/collapse the tree view widget. To do that, you can place the cursor over the tree arrow and type in the message box (*while the cursor is still over the arrow*):

"put the mouseloc"

This will return a pair of card coordinates, e.g. "65,121"

2. Then you can do:

"click at 65,121"

This will make the tree view to expand/collapse

PS: Make sure you are in Run mode.

Best,
Panos
--

bwmilby
Posts: 197
Joined: Wed Jun 07, 2017 5:37 am
Location: New Orleans, LA
Contact:

Re: Collapse and expand Tree View Widget from code

Post by bwmilby » Mon Sep 17, 2018 1:59 pm

I think I need to do another PR to make it easier :D
Brian Milby

Script Tracker https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 452
Joined: Fri Feb 06, 2015 4:03 pm

Re: Collapse and expand Tree View Widget from code

Post by LiveCode_Panos » Mon Sep 17, 2018 2:40 pm

Hehe, you are more than welcome :)

Post Reply

Return to “Talking LiveCode”