| PyGTK Tutorial | ||
|---|---|---|
| <<< Previous | Next >>> | |
Source widgets can send out drag data, thus allowing the user to drag things off of them, while destination widgets can receive drag data. Drag-and-drop destinations can limit who they accept drag data from, e.g. the same application or any application (including itself).
Sending and receiving drop data makes use of signals. Dropping an item to a destination widget requires both a data request (for the source widget) and data received signal handler (for the target widget). Additional signal handers can be connected if you want to know when a drag begins (at the very instant it starts), to when a drop is made, and when the entire drag-and-drop procedure has ended (successfully or not).
Your application will need to provide data for source widgets when requested, that involves having a drag data request signal handler. For destination widgets they will need a drop data received signal handler.
So a typical drag-and-drop cycle would look as follows:
Drag data request (when a drop occurs).
Drop data received (may be on same or different application).
Drag data delete (if the drag was a move).
Drag-and-drop procedure done.
| <<< Previous | Home | Next >>> |
| Supplying the selection | Properties |