안녕하세요...
트리뷰에서 드래그앤 드롭하기 정보를 볼랜드 뉴스그룹에서 퍼왔습니다.
http://www.borland.com/newsgroups/#bcbuilder
테스트 해 보았는데요.. 잘되더라구요...
============================================================================================
Hello G?ter,
"G?ter Wirth" <g.wirth@extec.de> schreef in bericht
news:970tlt$knd$07$2@news.t-online.com...
> Hi,
>
> yes I do, but the assigned OnDragOver function isn't called.
> Any ideas?
Hmm, what if you tried the following:
In the object inspector set Dragmode to dmAutomatic and then do the
following:
void __fastcall TMainForm::TreeView1DragDrop(TObject *Sender, TObject
*Source,
int X, int Y)
{
if( TreeView1->Selected == NULL ) return;
TNodeAttachMode AttachMode;
THitTests HT = TreeView1->GetHitTestInfoAt(X, Y);
TTreeNode *Node = TreeView1->GetNodeAt(X, Y);
if( HT.Contains(htOnItem) || HT.Contains(htOnIcon) ||
HT.Contains(htNowhere) || HT.Contains(htOnIndent) ) {
if( HT.Contains(htOnItem) || HT.Contains(htOnIcon) )
AttachMode = naAddChild;
else if( HT.Contains(htNowhere) )
AttachMode = naAdd;
else if( HT.Contains(htOnIndent) )
AttachMode = naInsert;
TreeView1->Selected->MoveTo(Node, AttachMode);
}
}
void __fastcall TMainForm::TreeView1DragOver(TObject *Sender, TObject
*Source,
int X, int Y, TDragState State, bool &Accept)
{
Accept = true;
}
For Drag & Drop in the same TTreeView the above works quite acceptable for
me...;-))
> Regards,
> G?ter Wirth
--
Greetings from sunny Amsterdam
Jan
email: bijster@worldonline.nl
http://home.worldonline.nl/~bijster
============================================================================================
이상 원문의 내용이었습니다.
도움이 되기었기를 바랍니다. ^^