Home » U++ Library support » TreeCtrl » Drag & Drop , Sort, GetValue( x )
Re: Drag & Drop , Sort, GetValue( x ) [message #19594 is a reply to message #19588] |
Mon, 22 December 2008 09:50 |
|
mirek
Messages: 13984 Registered: November 2005
|
Ultimate Member |
|
|
First small tip:
#define D3(x) RLOG("[" << GetSysTime() << "." << int(GetTickCount() % 10000u) << "] " << x)
In that case, you should be able to
D3(" sorted (" << i << ") get with i: " << b << "\t get with n: " << a);
(BTW, Sprintf is the least safe way how to format things anyway...)
To work with elements, you never should use 'i'. Always navigate elements in the tree using:
int GetChildCount(int id);
int GetChild(int id, int i);
- that will get you correct node ids.
You should never do it by using 'i' as in your example. GetItemAtLine is quite specific command, you probably would not want to use it either - it gets id of item and given *line* of TreeCtrl - that depends a lot on what nodes are actually open!
You only need to use ValueOrder in case that sorting requiris additional parametrs - e.g. values in TreeCtrl are 'columns' and you want to specify by which column you wish to sort - in that case you need to pass column number to comparison predicate - and ValueOrder allows you to do that (you derive from it, add column number, use it in comparision).
In 90% of cases, simplified methods with "int (*compare)(const Value& v1, const Value& v2)" will be enought.
Mirek
|
|
|
|
|
Drag & Drop , Sort, GetValue( x )
By: sapiency on Sun, 21 December 2008 00:13
|
|
|
Re: Drag & Drop , Sort, GetValue( x )
By: sapiency on Sun, 21 December 2008 14:04
|
|
|
Re: Drag & Drop , Sort, GetValue( x )
By: mirek on Mon, 22 December 2008 09:50
|
|
|
Re: Drag & Drop , Sort, GetValue( x )
By: sapiency on Sat, 27 December 2008 23:30
|
Goto Forum:
Current Time: Tue Jun 04 08:36:35 CEST 2024
Total time taken to generate the page: 0.02590 seconds
|