Defining Drop Zones
Move Handles also have definable "drop zones", which are basically
QPanel or
QLabel
controls that are setup to receive a move handle's set of moveable controls.
Qcodo will calculate and reject the operation of any control trying to be moved into
an area that is not defined as a valid drop zone. By default, when any move handle is configured,
it's parent is pre-defined as a valid drop zone.
For all our previous examples, the move handle's parent was the form, which meant that the moveable
controls were able to be dragged anywhere on the screen.
In this example, we setup
pnlPanel to be a move handle and a moveable control, but we call
RemoveAllDropZones to remove the entire from as a valid drop zone. And then we call
AddDropZone twice, one for each of the "drop zone" panels we created on the right.
Note how the interface now rejects any move of the moveable panel that doesn't end up in either
of the drop zones. Also note the feedback the interface gives to the user in terms of highlighting
the drop zones and changing the mouse cursor.
Finally, also note that as the
pnlPanel is moved from on drop zone to the next,
the its
ParentControl is actually being updated, as well, to being one of the two drop zone
panels.