Drag & Drop with TTreeView/TTVItem classes

Post Reply
User avatar
Luis Krause
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

Drag & Drop with TTreeView/TTVItem classes

Post 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!
"May the Source be with GNU"
Jonathan Hodder
Posts: 77
Joined: Sun Aug 26, 2007 11:53 pm

Re: Drag & Drop with TTreeView/TTVItem classes

Post 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
User avatar
Luis Krause
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

Re: Drag & Drop with TTreeView/TTVItem classes

Post 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,
"May the Source be with GNU"
Jonathan Hodder
Posts: 77
Joined: Sun Aug 26, 2007 11:53 pm

Re: Drag & Drop with TTreeView/TTVItem classes

Post 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.
User avatar
mmercado
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Re: Drag & Drop with TTreeView/TTVItem classes

Post by mmercado »

Dear Luis:

It's a real pleasure to have you with us again.

Un afectuoso abrazo.

Manuel Mercado Gómez.
manuelmercado at prodigy dot net dot mx
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: Drag & Drop with TTreeView/TTVItem classes

Post by Otto »

Luis,

Would you be so kind to post a little treeview drag & drop sample.
Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
Post Reply