Board index » cppbuilder » selecting TTreeNodes

selecting TTreeNodes


2005-04-01 02:02:53 PM
cppbuilder73
Hi,
I want to be able to select all decendants of a TTreeNode when
it is clicked, however, I cannot find a property or method
enabling this, and when I try to do it programatically only one
node can be selected at any one time even though I have the
TTreeView->MultiSelect property set to true. Here is the code I
am using:
void __fastcall TTalac::TreeMouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
TTreeView *T = (TTreeView*)Sender;
TTreeNode *A = T->GetNodeAt(X, Y);
if(!A)
return;
A->Expand(true);
TTreeNode *B = A->getFirstChild();
while(B)
{
B->Selected = true;
TTreeNode *C = B->getFirstChild();
while(C)
{
C->Selected = true;
C = B->GetNextChild(C);
}
B = A->GetNextChild(B);
}
}
I am using BCB6 on WinXP
Thanks,
Paul
 
 

Re:selecting TTreeNodes

"Paul Dowd" < XXXX@XXXXX.COM >wrote in message
Quote
Here is the code I am using:
Try this:
void __fastcall AddToList(TTreeNode *N, TList *L)
{
L->Add(N);
TTreeNode *C = N->getFirstChild();
while( C )
{
AddToList(C, L);
C = C->getNextSibling();
}
}
void __fastcall TTalac::TreeMouseDown(TObject *Sender, TMouseButton
Button, TShiftState Shift, int X, int Y)
{
TTreeView *T = static_cast<TTreeView*>(Sender);
TTreeNode *N = T->GetNodeAt(X, Y);
if( N )
{
N->Expand(true);
TList *Nodes = new TList;
try
{
AddToList(N, List);
T->Select(List);
}
__finally {
delete List;
}
}
}
Gambit
 

Re:selecting TTreeNodes

Many thanks
"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote

"Paul Dowd" < XXXX@XXXXX.COM >wrote in message
news:424ce40d$ XXXX@XXXXX.COM ...

>Here is the code I am using:

Try this:

...
 

{smallsort}