Caution: This version of this document is no longer maintained. For the latest documentation, see


Data associated with a drag event


typedef struct Ph_ev_drag_data {
    PhRect_t            rect;
    PhRid_t             rid;
    PhRect_t            boundary;
    PhDim_t             min;
    PhDim_t             max;
    PhDim_t             step;
    PhPoint_t           pos;
    unsigned long       key_mods;
    unsigned short            flags;
    unsigned short      button_state;
} PhDragEvent_t;


The PhDragEvent_t structure defines the data associated with Ph_EV_DRAG events (see PhEvent_t). It contains at least the following members:

A PhRect_t structure that contains the coordinates of the initial, current, or final drag rectangle, depending on the drag-event subtype value.
The ID of the region that initiated the drag operation. Your application needs to specify the region ID when it calls PhInitDrag() to initiate the dragging operation.
A PhRect_t structure that contains the coordinates of the rectangle that constrains the drag operation.
min, max
PhDim_t structures that define the minimum and maximum sizes of the drag rectangle, as specified in the call to PhInitDrag().
A PhDim_t structure that defines the drag operation's granularity, as specified in the call to PhInitDrag().
A PhPoint_t structure that indicates the current cursor position. This position isn't necessarily within the boundary rectangle.
Your application can use the modifier keys (e.g. Shift or Num Lock) to change the meaning of a drag event. When a modifier key is pressed or released, it's evaluated through a table, and the key_mods field is updated accordingly. This evaluation is done before the drag event is sent.

The key_mods member is a combination of the following bits:

If the Shift key is pressed, the Shift modifier is on; if it's released, the Shift modifier is off. Because some keys occur twice on the keyboard, a key release doesn't guarantee that the corresponding modifier is off — the matching key may still be pressed.

unsigned short flags
Flags that indicate which edges of the drag rectangle track the pointer. You can OR the following values into flags:
unsigned short button_state
The current state of the pointing-device buttons (i.e. which buttons are currently pressed):



See also:

PhDim_t, PhEvent_t, PhInitDrag(), PhPoint_t, PhRect_t

Dragging in the Events chapter of the Photon Programmer's Guide