Drag & Drop with TTreeView/TTVItem classes

Drag & Drop with TTreeView/TTVItem classes

Postby Luis Krause » Tue Jun 22, 2010 11:01 pm

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

Re: Drag & Drop with TTreeView/TTVItem classes

Postby Jonathan Hodder » Wed Jun 23, 2010 12:10 am

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
Jonathan Hodder
 
Posts: 77
Joined: Sun Aug 26, 2007 11:53 pm

Re: Drag & Drop with TTreeView/TTVItem classes

Postby Luis Krause » Wed Jun 23, 2010 12:39 am

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

Re: Drag & Drop with TTreeView/TTVItem classes

Postby Jonathan Hodder » Wed Jun 23, 2010 1:17 am

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.
Jonathan Hodder
 
Posts: 77
Joined: Sun Aug 26, 2007 11:53 pm

Re: Drag & Drop with TTreeView/TTVItem classes

Postby mmercado » Wed Jun 23, 2010 10:59 am

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

Re: Drag & Drop with TTreeView/TTVItem classes

Postby Otto » Wed Jun 23, 2010 9:48 pm

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
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6032
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 6 guests