Enhanced treeview sorting
Posted
#1
(In Topic #1055)
Regular

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
Posted
Guru

thatbruce said
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)
comp/src/gb.gui.base/.src/TreeView/_TreeView.class · master · Gambas / gambas · GitLab
like GridView_Sort() for one could be worth trying.
Good luck
Posted
Regular

thanks for the goodluck wish
1 guest and 0 members have just viewed this.


