Hey,
I’m writing a program that needs to decoded the mouse position inside of
a widgets callback routing, i am able to get the mouse position, but it
is relitive to the upper left hand corner of the screen. How can i get
it relitive position to the upper left hand corner of my window/widget.
You could use the following snippet to translate the mouse coordinates to be
relative to the window it is in…
This function was attached to the window in a Pt_CB_RAW callback that had
its mask set for Ph_EV_BUT_RELEASE events
int mouse_coordinates_cb( PtWidget_t *widget, ApInfo_t *apinfo,
PtCallbackInfo_t *cbinfo )
{
int mouse_x;
int mouse_y;
PhRect_t *canvas_rect;
PhPoint_t offset;
PhRect_t *event_rect;
Hey,
I’m writing a program that needs to decoded the mouse position inside of
a widgets callback routing, i am able to get the mouse position, but it
is relitive to the upper left hand corner of the screen. How can i get
it relitive position to the upper left hand corner of my window/widget.