MSM-Workstation
Macros

Go back to the alphabetic list of macros
Go back to the first page of this tutorial

%%EvPtrPos

This macro generates code that returns a specification of the value of a property of the most recent event.

The property for which the value is returned by this macro is the position of the mouse when the event occurred, which is equal to ^$Event("PPOS").

If the event is related to a gadget (component or control), the position is relative to the origin of that entity. If the event is related to a window, the position is relative to the current viewport of that window.
In any event, the value returned in this context is presented in the units that are specified by the property called Units for the entity in question.

Examples

Assume that the current control is a Generic Box, and that the image(s) in the box represent selectable entities. Further assume that each selectable entity is a rectangle of 24 by 32 units, with 10 entities on each row.

Set p=%%EvPtrPos,x=$p(p,",",1)\24,y=$p(p,",",2)\32
Set i=y*10+x
Do I^%msgbox("You selected item number "_i_".")

The above sequence of commands, while executed in the "action logic" for the event Pointer Up, would establish the internal sequence number of the entity that was selected.

See also

%%EvChoice, %%EvControl, %%EvElement, %%EvKey, %%EvNext, %%EvPrior, %%EvPtrButton, %%EvPtrState, %%EvSequence, %%EvType and %%EvWindow.