Page 1 of 1
Drag & Drop with TTreeView/TTVItem classes
Posted: Tue Jun 22, 2010 11:01 pm
by Luis Krause
Hi:
Has anyone done drag & drop with trees in which you can detect which
branch on the tree the mouse is released.
Using the std FWH drag&drop techiques I can drag an drop on the tree but I
can't figure out how to determine on which oItem the drop happens.
Thanks!
Re: Drag & Drop with TTreeView/TTVItem classes
Posted: Wed Jun 23, 2010 12:10 am
by Jonathan Hodder
Hi Luis
Good to hear from you on this forum again.
For the Tree question this is what I do -
I attach a cargo to each item with reference info.
Unfortunately this also assumes the reference cannot be dependant upon other tree items.
For example it would be a waste of time putting Recno() if you wanted to delete another record.
... but if the tree item automatically linked to the record on file and all links automatically get updated that would be nice
Though you have probably already worked this out.
All the best
Re: Drag & Drop with TTreeView/TTVItem classes
Posted: Wed Jun 23, 2010 12:39 am
by Luis Krause
Hi Jonathan... glad to hear from you too.
I found the answer myself (as usual, just post a question and
chances you'll answer yourself increase exponentially!)...
roughly:
::oTree:bDropFiles := {| nRow, nCol, aFiles| ::AcceptFiles( aFiles, nRow, nCol ) }
...
METHOD AcceptFiles( aFiles, nRow, nCol ) CLASS ....
oItem := ::oTree:HitTest( nRow, nCol )
IF oItem <> nil
// now we know where the drop happen do whatever you need here
ENDIF
....
RETURN Self
Regards,
Re: Drag & Drop with TTreeView/TTVItem classes
Posted: Wed Jun 23, 2010 1:17 am
by Jonathan Hodder
Sorry I misread your question - Identifying the tree Item it was dropped on
Yes you do it the same way as I ....
Yes you are right we probably can solve most of the problems ourselves or work our way around them.
Keep up the good work.
Re: Drag & Drop with TTreeView/TTVItem classes
Posted: Wed Jun 23, 2010 10:59 am
by mmercado
Dear Luis:
It's a real pleasure to have you with us again.
Un afectuoso abrazo.
Manuel Mercado Gómez.
Re: Drag & Drop with TTreeView/TTVItem classes
Posted: Wed Jun 23, 2010 9:48 pm
by Otto
Luis,
Would you be so kind to post a little treeview drag & drop sample.
Thanks in advance
Otto