DragKey
DragKey
Returns the drag key and mouse button state
Runtime-only Integer property
Applies to: Button , CheckBox , Graph , Grid , KCMLEdit , List Box , Picture Button , Radio , Rich Edit , Tree
Introduced in KCML version 6.60
This property returns the state of the Shift and Control keys and the mouse buttons during a Drop() event.
The following table shows the values that may be returned. More than one value may be combined and a mouse button will always be set eg. a shift+left-drag would have _SHIFTSTATE_LBUTTON + _SHIFTSTATE_SHIFT.
| Keys + Buttons | Value |
|---|---|
| Shift key | _SHIFTSTATE_SHIFT |
| Control key | _SHIFTSTATE_CTRL |
| Left mouse button | _SHIFTSTATE_LBUTTON |
| Middle mouse button | _SHIFTSTATE_MBUTTON |
| Right mouse button | _SHIFTSTATE_RBUTTON |
DEFEVENT Form1.TreeControl1.Drop()
SELECT CASE ..DragKey
CASE _SHIFTSTATE_LBUTTON
REM This is a simple drag
CASE _SHIFTSTATE_LBUTTON + _SHIFTSTATE_SHIFT
REM This is a Shift drag
CASE _SHIFTSTATE_LBUTTON + _SHIFTSTATE_CTRL
REM This is a Control drag
CASE _SHIFTSTATE_LBUTTON + _SHIFTSTATE_SHIFT + _SHIFTSTATE_CTRL
REM This is a Shift+Control drag
END SELECT
END EVENT