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!
Drag & Drop with TTreeView/TTVItem classes
- Luis Krause
- Posts: 59
- Joined: Tue Oct 11, 2005 1:39 am
- Location: Vancouver, Canada
Drag & Drop with TTreeView/TTVItem classes
"May the Source be with GNU"
-
- Posts: 77
- Joined: Sun Aug 26, 2007 11:53 pm
Re: Drag & Drop with TTreeView/TTVItem classes
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
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
- Luis Krause
- Posts: 59
- Joined: Tue Oct 11, 2005 1:39 am
- Location: Vancouver, Canada
Re: Drag & Drop with TTreeView/TTVItem classes
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,
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
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.
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
Dear Luis:
It's a real pleasure to have you with us again.
Un afectuoso abrazo.
Manuel Mercado Gómez.
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
Re: Drag & Drop with TTreeView/TTVItem classes
Luis,
Would you be so kind to post a little treeview drag & drop sample.
Thanks in advance
Otto
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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************