Click here to Skip to main content
15,891,567 members
Home / Discussions / C#
   

C#

 
GeneralSort TreeView items by different logic Pin
Gian13-May-04 5:13
Gian13-May-04 5:13 
GeneralRe: Sort TreeView items by different logic Pin
Heath Stewart13-May-04 8:56
protectorHeath Stewart13-May-04 8:56 
GeneralRe: Sort TreeView items by different logic Pin
Gian16-May-04 22:02
Gian16-May-04 22:02 
GeneralRe: Sort TreeView items by different logic Pin
Heath Stewart17-May-04 3:20
protectorHeath Stewart17-May-04 3:20 
GeneralRe: Sort TreeView items by different logic Pin
Gian17-May-04 4:58
Gian17-May-04 4:58 
GeneralRe: Sort TreeView items by different logic Pin
Heath Stewart17-May-04 5:13
protectorHeath Stewart17-May-04 5:13 
GeneralRe: Sort TreeView items by different logic Pin
Gian17-May-04 5:35
Gian17-May-04 5:35 
GeneralRe: Sort TreeView items by different logic Pin
Heath Stewart17-May-04 6:17
protectorHeath Stewart17-May-04 6:17 
No, there's not style to set. Again, read the documentation for the TVM_SORTCHILDRENCB[^] message and related topics linked in the page.

Upon further inspection, however, I noticed that the first two params are actually the lParam values of the TVITEM struct, which - believe it or not - is not set by the TreeNode.Tag property. You would have to override the TreeNodeCollection.Add(TreeNode) method with your derivative class and use new to override the Nodes property for both the TreeView and TreeNode classes to return your TreeNodeCollection derivative (they're not virtual).

Your Add would be very similar to the current method, which you can see using .NET Reflector[^]. In fact, since some of those method calls are private or internal, you'll have to use base.Add(TreeNode) to get the index, and then global alloc the Tag to get an IntPtr then set the TVITEM using the TVM_SETITEM message.

You could do all this, or just sort the tree as I mentioned before yourself, which the TreeView class does instead of using the TVM_SORTCHILDREN message for the Tree-View common control.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Sort TreeView items by different logic Pin
Gian17-May-04 23:16
Gian17-May-04 23:16 
GeneralRe: Sort TreeView items by different logic Pin
Heath Stewart18-May-04 3:37
protectorHeath Stewart18-May-04 3:37 
GeneralRe: Sort TreeView items by different logic Pin
Gian19-May-04 5:25
Gian19-May-04 5:25 
Generalhelp with winuser.h Pin
HappyPaws13-May-04 4:28
HappyPaws13-May-04 4:28 
GeneralRe: help with winuser.h Pin
Judah Gabriel Himango13-May-04 6:36
sponsorJudah Gabriel Himango13-May-04 6:36 
GeneralRe: help with winuser.h Pin
Heath Stewart13-May-04 8:37
protectorHeath Stewart13-May-04 8:37 
GeneralRe: help with winuser.h Pin
Heath Stewart13-May-04 8:37
protectorHeath Stewart13-May-04 8:37 
GeneralRe: help with winuser.h Pin
HappyPaws14-May-04 1:37
HappyPaws14-May-04 1:37 
Generalregd DataGrids Pin
karteek13-May-04 4:06
karteek13-May-04 4:06 
Generalregd dialogs Pin
karteek13-May-04 3:41
karteek13-May-04 3:41 
GeneralRe: regd dialogs Pin
Heath Stewart13-May-04 3:47
protectorHeath Stewart13-May-04 3:47 
GeneralRe: regd dialogs Pin
karteek13-May-04 4:07
karteek13-May-04 4:07 
GeneralRe: regd dialogs Pin
Heath Stewart13-May-04 4:51
protectorHeath Stewart13-May-04 4:51 
GeneralCancel more than a click Pin
sreejith ss nair13-May-04 2:55
sreejith ss nair13-May-04 2:55 
GeneralRe: Cancel more than a click Pin
Heath Stewart13-May-04 3:19
protectorHeath Stewart13-May-04 3:19 
GeneralDES Crypto help Pin
yyzzababa13-May-04 2:43
yyzzababa13-May-04 2:43 
GeneralRe: DES Crypto help Pin
gek_at13-May-04 2:50
gek_at13-May-04 2:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.