Close nodes in Tree View widget

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Close nodes in Tree View widget

Tore Nilsen via use-livecode
I'm working with the Tree View widget and have found that leaf nodes  
stay open even after the arrayData has changed. For example, if I  
click on leaf node 2 and 4 to open them up for further inspection but  
then load new arrayData those same leaf nodes are already expanded  
with the new data.

Is there a way via code to close all the leaf nodes, or to restrict  
the widget so only 1 node can be open at a time?

--Andrew Bell


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Close nodes in Tree View widget

Tore Nilsen via use-livecode
I can't try it out right now - but would it be any good to set the
arraydata to empty, and then load the new values you want ? That might
(effectively) delete and recreate the relevant nodes, and thereby reset
the status of the leaf nodes.

Alex.


On 13/06/2018 19:13, Andrew Bell via use-livecode wrote:

> I'm working with the Tree View widget and have found that leaf nodes
> stay open even after the arrayData has changed. For example, if I
> click on leaf node 2 and 4 to open them up for further inspection but
> then load new arrayData those same leaf nodes are already expanded
> with the new data.
>
> Is there a way via code to close all the leaf nodes, or to restrict
> the widget so only 1 node can be open at a time?
>
> --Andrew Bell
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Close nodes in Tree View widget

Tore Nilsen via use-livecode
In reply to this post by Tore Nilsen via use-livecode
Setting the arrayData to EMPTY acts the same as setting the arrayData  
to some other array: the open nodes remain open. I even tried changing  
the number of elements in the array to something as low as 1 but it  
still remembered what nodes had been open when setting the arrayData  
to something with more elements.

There are no properties in the dictionary that describe this type of  
operation. The closest I could find was hilitedElement but that  
doesn't actually open or close a node leaf. In fact, if you set the  
hilitedElement to a node that isn't open it will hilite the next node  
that is open instead. (bug?)

This isn't critical for this project as it is just an internal tool  
that only I use, but the only workaround I could come up with is to  
delete the widget and then create the widget again via script along  
with all the attributes.

--Andrew Bell


> Date: Wed, 13 Jun 2018 23:02:52 +0100
> From: Alex Tweedly <[hidden email]>
> Subject: Re: Close nodes in Tree View widget
>
> I can't try it out right now - but would it be any good to set the
> arraydata to empty, and then load the new values you want ? That might
> (effectively) delete and recreate the relevant nodes, and thereby reset
> the status of the leaf nodes.
>
> Alex.
>




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Close nodes in Tree View widget

Tore Nilsen via use-livecode
Could you open a bug report/enhancement request for this? I’ll see what I can do about a PR targeting 9.1 release.

I can think of several ways to address the situation. Easiest would be to reset the array that handles what is expanded when the data array is changed. Would not be hard to add a separate handler to collapse all nodes.

Once done, you could pull the updated source and compile/use locally until it makes it into a release.

Thanks,
Brian
On Jun 14, 2018, 8:43 AM -0500, Andrew Bell via use-livecode <[hidden email]>, wrote:

> Setting the arrayData to EMPTY acts the same as setting the arrayData
> to some other array: the open nodes remain open. I even tried changing
> the number of elements in the array to something as low as 1 but it
> still remembered what nodes had been open when setting the arrayData
> to something with more elements.
>
> There are no properties in the dictionary that describe this type of
> operation. The closest I could find was hilitedElement but that
> doesn't actually open or close a node leaf. In fact, if you set the
> hilitedElement to a node that isn't open it will hilite the next node
> that is open instead. (bug?)
>
> This isn't critical for this project as it is just an internal tool
> that only I use, but the only workaround I could come up with is to
> delete the widget and then create the widget again via script along
> with all the attributes.
>
> --Andrew Bell
>
>
> > Date: Wed, 13 Jun 2018 23:02:52 +0100
> > From: Alex Tweedly <[hidden email]>
> > Subject: Re: Close nodes in Tree View widget
> >
> > I can't try it out right now - but would it be any good to set the
> > arraydata to empty, and then load the new values you want ? That might
> > (effectively) delete and recreate the relevant nodes, and thereby reset
> > the status of the leaf nodes.
> >
> > Alex.
> >
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Close nodes in Tree View widget

Tore Nilsen via use-livecode
Thank you!
https://quality.livecode.com/show_bug.cgi?id=21361

--Andrew Bell


Quoting Brian Milby <[hidden email]>:

> Could you open a bug report/enhancement request for this? I’ll see  
> what I can do about a PR targeting 9.1 release.
>
> I can think of several ways to address the situation. Easiest would  
> be to reset the array that handles what is expanded when the data  
> array is changed. Would not be hard to add a separate handler to  
> collapse all nodes.
>
> Once done, you could pull the updated source and compile/use locally  
> until it makes it into a release.
>
> Thanks,
> Brian
> On Jun 14, 2018, 8:43 AM -0500, Andrew Bell via use-livecode  
> <[hidden email]>, wrote:
>> Setting the arrayData to EMPTY acts the same as setting the arrayData
>> to some other array: the open nodes remain open. I even tried changing
>> the number of elements in the array to something as low as 1 but it
>> still remembered what nodes had been open when setting the arrayData
>> to something with more elements.
>>
>> There are no properties in the dictionary that describe this type of
>> operation. The closest I could find was hilitedElement but that
>> doesn't actually open or close a node leaf. In fact, if you set the
>> hilitedElement to a node that isn't open it will hilite the next node
>> that is open instead. (bug?)
>>
>> This isn't critical for this project as it is just an internal tool
>> that only I use, but the only workaround I could come up with is to
>> delete the widget and then create the widget again via script along
>> with all the attributes.
>>
>> --Andrew Bell
>>
>>
>> > Date: Wed, 13 Jun 2018 23:02:52 +0100
>> > From: Alex Tweedly <[hidden email]>
>> > Subject: Re: Close nodes in Tree View widget
>> >
>> > I can't try it out right now - but would it be any good to set the
>> > arraydata to empty, and then load the new values you want ? That might
>> > (effectively) delete and recreate the relevant nodes, and thereby reset
>> > the status of the leaf nodes.
>> >
>> > Alex.
>> >
>>
>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode