TreeView Header Sorting

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 06/07/2006 at 07:07, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   9.102 
Platform:   Windows  ; Mac  ;  Mac OSX  ; 
Language(s) :     C++  ;

---------
Any information on how this actually works? I see that there is a method TreeViewFunctions::GetHeaderSortArrow(), but there is no arrow on any of the column headers. So, one supposes that I supply the arrow and which column currently is used for sorting?

Also, would TreeViewFunctions::HeaderClick() be used to possibly initiate sorting (change ascending/descending for instance)?

Thanks,

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 06/07/2006 at 10:00, xxxxxxxx wrote:

No clue, as I haven´t used this yet but I´d be interested in knowing it too. :-)

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 06/07/2006 at 10:04, xxxxxxxx wrote:

I think that I have this 'sorted' (bah-dum-bah). ;)

GetHeaderSortArrow() wants a non-zero value to determine sort direction (though the docs don't specify what values are expected - eh hem). I'm using 0 for no sort, -1/1 for sorted directions.

HeaderClick() can be used to change sort direction or select a new sort column.

Here's my code for TreeViewFunctions:

LONG GetHeaderSortArrow(void* root, void* userdata, LONG lColID)  
{  
     rroot =     (ResultsRoot* )root;  
     if (rroot->GetSortCol() == lColID)     return rroot->GetSortDir();  
     return 0;  
}  
Bool HeaderClick(void* root, void* userdata, LONG lColID, LONG lChannel, Bool bDblClk)  
{  
     // Ignore double-clicks and middle/right mouse buttons  
     if (bDblClk)                                   return FALSE;  
     if (lChannel !=     BFM_INPUT_MOUSELEFT)     return FALSE;  
     rroot =     (ResultsRoot* )root;  
     if (rroot->GetSortCol() == lColID)          rroot->InvertSortDir();  
     else                                             rroot->SetSortCol(lColID);  
     return     TRUE;  
}  

P.S.: Note that the actual sorting must be done in your own code when conditions warrant (change of column, change of sort direction).

3D Designer, now you know. :)