I'm looking for some ideas here.
To put it at its' simplest, the TreeView sort just sorts on the text of each node. What I'd like in this situation (of a very large tree) is to enable the user to sort the tree based on some attribute of the nodes. So the first idea is to add a buttonbox to the proposed control that has a filter menu that would enable different sorting keys. That was not hard. But now, how to implement the sort?
My second idea is to override the _treeview._treeview_item class with something more sophisticated. That looks difficult in terms of a solution.
Third thought, override the treeview.Sort mechanism. But there doesn't seem to be an access to that?
Any thoughts?
tia
b
Enhanced treeview sorting
Enhanced treeview sorting
Have you ever noticed that software is never advertised using the adjective "spreadable".
- BruceSteers
- Posts: 1582
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Enhanced treeview sorting
thatbruce wrote: ↑Sunday 11th June 2023 11:08am I'm looking for some ideas here.
To put it at its' simplest, the TreeView sort just sorts on the text of each node. What I'd like in this situation (of a very large tree) is to enable the user to sort the tree based on some attribute of the nodes. So the first idea is to add a buttonbox to the proposed control that has a filter menu that would enable different sorting keys. That was not hard. But now, how to implement the sort?
My second idea is to override the _treeview._treeview_item class with something more sophisticated. That looks difficult in terms of a solution.
Third thought, override the treeview.Sort mechanism. But there doesn't seem to be an access to that?
Any thoughts?
tia
b
I have not tried it but what about TreeView1_BeforeSort() event?
If you use Stop Event will it stop the automatic sorting and let you do it manually?
EDIT: aah i just studied the source, seems BeforeSort does not cancel anything
the code does this...
Raise BeforeSort
....
It should do this to be an event that can be cancelled..
Dim bCancel As Boolean = Raise BeforeSort
If bCancel Then Return
There's quite a few events/methods to try to override in _TreeView.class (with underscore)
https://gitlab.com/gambas/gambas/-/blob ... View.class
like GridView_Sort() for one could be worth trying.
Good luck
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: Enhanced treeview sorting
mmmm lots to absorb there.
thanks for the goodluck wish
thanks for the goodluck wish
Have you ever noticed that software is never advertised using the adjective "spreadable".