Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Getting events to a PtRaw widget which is contained by a PtPane widget
Ref. No. QNX.000009910
Category(ies) Development
Issue We have a PtRaw inside a PtPane widget.
We would like to get the following events:

* when user clicks in the region, we want to know the position where the user clicked,
* when and where user right-clicked(time and position),
* when the user drags over the region (feedback to the user where is he selecting).



Solution *Attach a Pt_CB_ARM callback to the raw widget. Make the raw widget selectable.

*Attach a Pt_CB_MENU callback to the raw widget.
Make the widget menuable (i.e. widget flags: Pt_ARG_FLAGS). In boath of these requests you can get the position of the event from cbinfo->event in two ways:

I: Relative coordinates like this
x09x09rect = PhGetRects(cbinfo->event);
(rect.ul and rect.lr will be equivalent as clicks are point events)

II: Absolute(Global photon event space) coordinates like this:
x09x09PhPointerEvent_t *pev = PhGetData(cbinfo->event);
then look at pev->pos.x and pev->pos.y.

* See PhInitDrag() or attach a raw callback sensitive to Ph_EV_MOTION_BUTTON events, and do as you wish with the data.