Enhanced treeview sorting

Post

Posted
Rating:
#1 (In Topic #1055)
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
 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

Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘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
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
mmmm lots to absorb there.

thanks for the goodluck wish  :)

Online now: No Back to the top
1 guest and 0 members have just viewed this.