FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Drag & Drop with TTreeView/TTVItem classes
Posts: 59
Joined: Tue Oct 11, 2005 01:39 AM
Drag & Drop with TTreeView/TTVItem classes
Posted: 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"
Posts: 77
Joined: Sun Aug 26, 2007 11:53 PM
Re: Drag & Drop with TTreeView/TTVItem classes
Posted: 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
Posts: 59
Joined: Tue Oct 11, 2005 01:39 AM
Re: Drag & Drop with TTreeView/TTVItem classes
Posted: 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"
Posts: 77
Joined: Sun Aug 26, 2007 11:53 PM
Re: Drag & Drop with TTreeView/TTVItem classes
Posted: Wed Jun 23, 2010 01: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.
Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM
Re: Drag & Drop with TTreeView/TTVItem classes
Posted: 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
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Drag & Drop with TTreeView/TTVItem classes
Posted: Wed Jun 23, 2010 09:48 PM

Luis,

Would you be so kind to post a little treeview drag & drop sample.
Thanks in advance
Otto

Continue the discussion