Another DND question

Rainer Koschnick arkay at gmx.net
Wed Apr 2 04:02:50 PDT 2008


Since there was no response to my last one... ;)

I now implemented DND on a wxTreeCtrl, because the BeginDrag() & 
EndDrag() implementation combo didn't show a drag image.

I have 2 wxListCtrls & 1 wxTreeCtrl on my wxFrame.

The first wxListCtrl has a list of available satellite services
The 2nd shows the services which are contained in a bouquet
and the wxTreeCtrl has the list of user bouquets.

The tree has the following layout:

TV Bouquets
   Bouquet A
   Bouquet B
   Bouquet C
Radio Bouquets
   Bouquet A
   Bouquet B
   Bouquet C
etc.

So the user can select a bouquet from the tree and see the services 
which are are assigned to it in the 2nd list.

- The user can drag services from list 1 (all services) to list 2 
(services in selected bouquet)
- The user can drag services from list 1 (all services) to the bouquet 
tree "Bouquet X" nodes
- The user can drag services from list 2 (services in selected bouquet) 
to bouquet tree "Bouquet X" nodes
- The user can NOT drag services from either list to the "TV Bouquets" 
and "Radio Bouquets" nodes
- But the user can drag "Bouquet X" tree nodes to the TV & Radio 
Bouquets tree nodes (to move bouquets)

And herein lies the problem.  I have to forbid dropping if it's a 
service or bouquet service and allow it if it's a bouquet.  And I want 
to show whether dropping is possible or not (and not just ignore the 
data in wxDropTarget::OnData()).

There is no way in wxDropTarget::OnDragOver() to find out what the user 
is dropping in order to decide which wxDragResult to return.  GetData() 
can (according to the doc) *only* be called in OnData().  I don't see a 
way of getting a reference to the wxDropSource object either, otherwise 
I could probably add some code there.

So is there any way to accomplish what I want to do here?

Thanks,
Rainer



More information about the wx-users mailing list