DragnDrop solution

This is a continuation from the previous post and I need a little help here.
In this script you can DragnDrop from source to target to either paste the BG color of source on target or swap the colors based on the option selected.
Paste option is working file but I how to swap the colors?

Prashant

dnd.py (3.13 KB)

···

Connect with friends all over the world. Get Yahoo! India Messenger.

Prashant Saxena wrote:

This is a continuation from the previous post and I need a little help here.
In this script you can DragnDrop from source to target to either paste the BG color of source on target or swap the colors based on the option selected.
Paste option is working file but I how to swap the colors?

There really isn't any way to pass information back to the drop source, other than the flag indicating whether a move or copy should be done. (IOW, whether the source should delete the source data or not.) That is the return value of OnData, and it is returned from DoDragDrop.

If you are sure that the DnD will only occur within the same instance of the application, and never to other applications or additional instances of the same application, then you can do some tricks to help your drop target get a reference back to the drop source window. For example you could add the Window Id to the custom data object, and then in the OnSwapColor you can use wx.FindWindowById to get a reference to the source and then change its color.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!