Board index » cppbuilder » TTreeView question?

TTreeView question?


2004-05-26 06:29:39 AM
cppbuilder71
Hi,
I have a TTreeView named TeeView1. It represents the parent-child relationship of the forms created in my software. for example.. Using my software if you created Form1 (will be the root node!) and then from Form1 if you create Form2 and Form3. and from Form2 if you create Form2a then the TreeView1 looks
like following...
Form1
|
|___Form2
| |
| |___Form2a
|
|
|___Form3
what I want to do is provide the user to be able to drag Form2a and drop it under Form3, so that Form2a becomes child of Form3. Now I want TreeView1 to look like...
Form1
|
|___Form2
|
|
|___Form3
|
|___Form2a
I can take care of the pointers etc that determine that Form2a now is the child of Form3, but don't know how to take care of the "drag and drop" part
I will appreciate your help.
thanks,
Veebo
 
 

Re:TTreeView question?

Here is some simple drag and drop code:
void __fastcall TMainForm::TreeView1DragOver(TObject *Sender,
TObject *Source, int X, int Y, TDragState State, bool &Accept)
{
if( Sender == TreeView1 && Source == Sender
&& TreeView1->DropTarget != TreeView1->Selected )
{
Accept = true;
}
else
{
Accept = false;
}
}
void __fastcall TMainForm::TreeView1DragDrop(TObject *Sender,
TObject *Source, int X, int Y)
{
TreeView1->Selected->MoveTo( TreeView1->DropTarget, naAddChild );
}
Todd
"Veebo" < XXXX@XXXXX.COM >wrote in message news:40b3c8d3$ XXXX@XXXXX.COM ...
Quote

I have a TTreeView
...
but don't know how to take care of the "drag and drop" part