The following methods are used to convert and map coordinates of a dialog or dialog control.
>>-aDialogControl~LogRect2AbsRect(--left--,--top--,--right--,--bottom--)-><
The LogRect2AbsRect method converts the coordinates from dialog units to screen pixels.
The arguments are:
The position of the upper left corner, in dialog units.
The position of the lower right corner, in dialog units.
A compound variable that stores the four screen pixel coordinates. The position of the upper left corner is stored in RetStem.left and RetStem.top. The position of the lower right corner is stored in RetStem.right and RetStem.bottom. The tails left, top, right, and bottom must be uninitialized symbols.
absrect. = MyDialog~LogRect2AbsRect(5, 5, 10, 10) say "Screen pixel rectangle=" absrect.left "," absrect.top ",", absrect.right "," absrect.bottom
>>-aDialogControl~AbsRect2LogRect(--left--,--top--,--right--,--bottom--)-><
The AbsRect2LogRect method converts the coordinates from screen pixels to dialog units.
The arguments are:
The position of the upper left corner, in screen pixels.
The position of the lower right corner, in screen pixels.
A compound variable that stores the four screen dialog units. The position of the upper left corner is stored in RetStem.left and RetStem.top. The position of the lower right corner is stored in RetStem.right and RetStem.bottom. The tails left, top, right, and bottom must be uninitialized symbols.
rectdunit. = MyDialog~AbsRect2LogRect(20, 20, 40, 40) say "Dialog unit rectangle=" rectdunit.left "," rectdunit.top ",", rectdunit.right "," rectdunit.bottom
>>-aDialogControl~ScreenToClient(--x--,y--)--------------------><
The ScreenToClient method maps the coordinates relative to the upper left corner of the screen, to a location within the client area relative to the upper left corner of the dialog's client area.
The arguments are:
The horizontal position, in screen pixels.
The vertical position, in screen pixels.
The horizontal and vertical positions of the specified location relative to the upper left corner of the client area, separated by a blank.
>>-aDialogControl~ClientToScreen(--x--,y--)--------------------><
The ClientToScreen method maps the coordinates relative to the dialog's client area to the coordinates relative to the upper left corner of the screen.
The arguments are:
The horizontal position in screen pixels.
The vertical position in screen pixels.
The horizontal and vertical positions of the specified location relative to the location (0,0) of the screen, separated by a blank.