Alternative to sort_list
Posted: Tue Jun 13, 2017 8:58 pm
In a Windows application I have a treeview with items. The treeview is sorted on two levels, each on an alphanumeric field.
When the user has selected an item, I want to be able to select the next item (the one below or the one above). As in:
if the user has selected C.2 I want to be able to move that selection to C.3 or C.1. From C.3 I might want to move the selection to D.1, and so on.
This is fairly easy if I know the order the items are displayed in the treeview. But I don't necessarily do that.
The treeview items seem to be sorted differently than the sort_list does. For instance I get this order in the treeview:
(real data, it makes sense to us)
and this with sort_list:
Is there a way to have sort_list (or an alternative) sort the same way as the treeview is displayed? Or is there a way to tell the treeview to go to the next (or previous) item?
When the user has selected an item, I want to be able to select the next item (the one below or the one above). As in:
Code: Select all
Treeview and items:
A
B
C
C.1
C.2
C.3
D
D.1
D.2
E
This is fairly easy if I know the order the items are displayed in the treeview. But I don't necessarily do that.
The treeview items seem to be sorted differently than the sort_list does. For instance I get this order in the treeview:
Code: Select all
Lok: P31- Ord: 4656
Lok: R10-F3- Ord: 4656
Lok: R12F3- Ord: 46
Lok: R1-F4- Ord: 465and this with sort_list:
Code: Select all
Lok: P31- Ord: 4656
Lok: R1-F4- Ord: 465
Lok: R10-F3- Ord: 4656
Lok: R12F3- Ord: 46