Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
mirek is currently offline  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
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Optional highlighting of focused node's control along with value
Next Topic: gui crashes.
Goto Forum:
  


Current Time: Tue Jun 04 08:36:35 CEST 2024

Total time taken to generate the page: 0.02590 seconds