xytoxy(
POINTRECTANGLE
,
FROMCOORDINATES
,
TOCOORDINATES
)

The xytoxy( function converts a point or rectangle from one co-ordinate system to another.


Parameters

This function has three parameters:

pointrectangle – the point (see point() or rectangle (see rectangle() you want to convert.

fromcoordinates – the current co-ordinate system for the point or rectangle in the first parameter. This may be screen relative, window relative, or form relative. See below for details.

tocoordinates – the new co-ordinate system for the point or rectangle. This may be screen relative, window relative, or form relative. See below for details.


Description

The xytoxy( function converts a point or rectangle from one co-ordinate system to another. The type of data returned depends on the type passed in: If you pass it a point, it returns a point, if you pass it a rectangle, it returns a rectangle.

Panorama has three different graphics co-ordinate systems - screen, window, and form.

Screen relative co-ordinates (sometimes also called global co-ordinates) are expressed relative to the top left corner of the main screen. In screen relative co-ordinates, the position 0,0 refers to the top left corner of the screen. To specify screen relative co-ordinates use "Screen", "screen", "S" or "s".

Window relative co-ordinates are expressed relative to the top left corner of the current window. In window relative co-ordinates, the position 0,0 refers to the top left corner of the current window. If the window has scroll bars, window relative co-ordinates are not affected by scrolling. To specify window relative co-ordinates use "Window", "window", "W" or "w".

Form relative co-ordinates are expressed relative to the top left corner of the current form. In form relative co-ordinates, the position 0,0 refers to the top left corner of the form. If the window has scroll bars, form relative co-ordinates are affected by scrolling – for example, 0,0 will refer to a position that is not visible if the form has been scrolled. To specify form relative co-ordinates use "Form", "form", "F" or "f".

The info(“click”) function returns the screen relative co-ordinates of the last mouse click. This procedure will convert the mouse click point to form relative, then check to see if the mouse was clicked in the top inch of the form.

local mousePoint
mousePoint=xytoxy(info("click"),"s","f")
if v(mousePoint)<=72
    message "You clicked in the top inch of the form"
endif

Error Messages

xytoxy( function conversion error (unknown co-ordinate system). – This message indicates that Panorama doesn’t understand the conversion you asked it to do. For example, if you asked it to convert from “local” to “global” it would not know what you were asking. You’ll also see this error if you ask it to convert from a co-ordinate system to itself, for example “screen” to “screen”.


See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0