User Tools

Site Tools


getposition_get_control_position_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== GETPOSITION (get control or window position) ====== Previous pageReturn to chapter overviewNext page

NewC7.jpg

GETPOSITION(| control |[,x ] [, y ] [, width ] [, height ] )

| window |

blk2blue.jpg

GETPOSITION Gets the position and size of an APPLICATION, WINDOW, REPORT or control.
control A field number or field equate label for the control from which to get the information. If control is zero (0), it specifies the window.
window The label of an APPLICATION, WINDOW, or REPORT structure, or a reference to any of those structures.
X An integer variable to receive the horizontal position of the top left corner.
Y An integer variable to receive the vertical position of the top left corner.
width An integer variable to receive the width.
height An integer variable to receive the height.

GETPOSITION gets the position and size of an APPLICATION, WINDOW, REPORT, or control. The window parameter is used to get the position and/or dimensions of a window that currently is not on top or has focus. The position and size values are dependent upon the presence or absence of the SCROLL attribute on the control. If SCROLL is present, the values are relative to the virtual window. If SCROLL is not present, the values are relative to the top left corner of the currently visible portion of the window. This means the values returned always match those specified in the AT attribute or most recent SETPOSITION.

The values in the x, y, width, and height parameters are measured in dialog units. Dialog units are defined as one-quarter the average character width by one-eighth the average character height. The size of a dialog unit is dependent upon the size of the default font for the window. This measurement is based on the font specified in the FONT attribute of the window, or the system default font specified by Windows.

Example:

Screen WINDOW,PRE(Scr)

       ENTRY(@N3),USE(Ctl:Code)

       ENTRY(@S30),USE(Ctl:Name)

       BUTTON('OK'),USE(?OkButton),KEY(EnterKey)

       BUTTON('Cancel'),USE(?CanxButton),KEY(EscKey)

      END

X       SHORT

Y       SHORT

Width   SHORT

Height  SHORT

CODE

OPEN(Screen)

GETPOSITION(?Ctl:Code,X,Y,Width,Height)

See Also:

SETPOSITION

PROP:Pixels

getposition_get_control_position_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1