xcall AUI, AUI_WINDOW, opflag {,lft,top,rgt,btm {,rows,cols {,tsts,bsts {,cid,hg,vg {,monitors {,winsts}}}}}}
The AUI_WINDOW class is used for querying and changing the parameters of the window or monitor(s), such as its size, position, display state, number of rows and columns, etc.
This function has both a subroutine and a print tab implementation.
Parameters
opflag (Num) [in]
specifies the window state desired, or an option to query the current state, per the following table.
Symbol |
Value |
Meaning |
---|---|---|
SW_QRYCTLPIXCLI |
-4 |
Same as SW_QRYCTLPIX (-3), except that it returns the control's client rectangle in the lft,top,rgt and btm parameters, instead of the control's window rectangle relative to the desktop. The client rectangle always starts at 0,0, so that the rgt and btm parameters give the width and height of the "usable" area (not counting borders, menus, caption) of the control. |
SW_QRYCTLPIX or SW_QRYPIX |
-3 |
Same as -1 (SW_QRYCTLUNV) but returns the coordinates of the target window or control in pixels rather than Universal units. |
SW_QRYMONPIX or SW_QRYMON |
-2 |
Query (multiple) monitor information. See cid. Returns rectangle (in pixel coordinates) in lft, top, rgt, btm. |
SW_QRYCTLUNV or SW_QUERY |
-1 |
Query the current settings and update all of the passed parameters accordingly, return values in Universal units. See cid. |
SW_HIDE |
0 |
Hide window (i.e. make it invisible) |
SW_SHOWNORMAL |
1 |
Show window in normal format (neither minimized nor maximized) |
SW_SHOWMINIMIZED |
2 |
Activate window and show it minimized (displayed on the task bar) |
SW_SHOWMAXIMIZED |
3 |
Activate window and show it maximized |
SW_SHOWNOACTIVATE |
4 |
Show window in its most recent position but do not activate it |
SW_SHOW |
5 |
Activate and show window in its current size and position |
SW_MINIMIZE |
6 |
Minimize window and activate the next window in the task list |
SW_MINNOACTIVE |
7 |
Displays the window as a minimized window. This value is similar to SW_SHOWMINIMIZED, except the window is not activated |
SW_SHOWNA |
8 |
Display window in its current size and position, but do not activate it |
SW_RESTORE |
9 |
Restore a minimized or maximized window to its original position |
SW_WINDEFAULT |
10 |
Display the window in the default state as defined in the shortcut or startup info associated with the application |
SW_ASHDEFAULT |
65 |
Causes the window to initially be reset based on the current settings file (as edited on the Settings menu and saved with the File..Save menu). Omit all other parameters, or set them to 0 (except -1 for tsts and bsts). |
lft, top, rgt, btm (Num) [in/out]
specify or retrieve the coordinates of the Window or monitor. Window coordinates (cid > 0) are in standardized units that range from 0,0 for the upper left corner of the screen to 10000,10000 for the bottom right. You may leave these 0 to retain the current window coordinates (if you just want to change the rows / cols or status lines.) Monitor coordinates (opflag = -2, cid < 0) are in pixels (and may be negative for secondary monitors).
When opflag = -1 and cid < 0 (to retrieve desktop resolution), these parameters taken on new meaning. lft and top return the dialog (altpos) grid size in pixels, while rgt and btm return the primary monitor size in dialog (altpos) grid units. (This provides an idea of the maximum size dialog that will fit on the screen.)
rows ,cols (Num) [in/out]
cid |
opflag |
Target object, information returned (for queries) |
---|---|---|
0 |
< 0 |
Return the main window grid in rows and columns (e.g. 24 x 80) |
0 |
>= 0 |
Set the main window grid in rows and columns. Equivalent of tab(-5,rows) if rows > 0 and tab(-6,cols) if cols > 0 |
0 |
>0 |
Return the size of the target control in millirows and millcolumns. |
<0 |
-1 |
Return the dialog size overhead (title bar, borders, margins) in universal coordinates. Note that as a general rule, the vertical overhead is equivalent to one logical row (one vertical dialog unit) and the horizontal overhead is negligible. |
<0 |
-3 |
Return the dialog size overhead (title bar, borders, margins) in pixels. |
tsts, bsts (Num) [in / out]
specify or retrieve the visible / invisible state of the top and bottom status lines (1=visible, 0=invisible). You may leave these -1 (or omit them) to retain the current status line state.
Identifies the window, control, or monitor that the operation is to be performed on, per the following table. Default is 0, i.e. the main window. See Comments.
cid |
opflag |
Target object, information returned (for queries) |
---|---|---|
>0 (or name) |
0-9 |
Perform the display operation specified by opflag (e.g. show, hide, etc.) on the specified control or window. No information returned. Operations on non-window controls may be limited to SW_HIDE and SW_SHOW. |
>0 (or name) |
-1 or -3 |
cid identifies the control to be queried by its control number or name. lft, top, rgt, btm return the coordinates of the control, in universal coordinates (if opflag = -1), or pixels (if opflag = -3). rows and cols return the logical size of the control in millirows and columns. |
0 |
-1 or -3 |
Main window. lft, top, rgt, btm return the coordinates of the control, in universal coordinates (if opflag = -1), or pixels (if opflag = -3). rows and cols return the logical size of the control in millirows and columns. tsts, bsts indicate the status line presence. |
-1 |
-1 |
Primary monitor. lft and top return dialog (altpos) grid size. rgt and btm return monitor size in dialog units. hg and vg return monitor resolution in pixels. |
-1 |
-2 |
Primary monitor. lft, top, rgt, btm return pixel coordinates of monitor. |
-2 |
-1 |
Primary monitor. Same as if cid = -1 except subtracts area of the task bar from the returned parameters. |
-2 |
-2 |
Primary monitor work area. lft, top, rgt, btm return pixel coordinates of monitor less task bar. |
-3 |
-2 |
Second monitor. lft, top, rgt, btm return pixel coordinates of monitor (which may be negative if second monitor is to left of primary monitor). |
-4 |
-2 |
Second monitor work area. lft, top, rgt, btm return pixel coordinates of monitor less task bar. |
-5 |
-2 |
Third monitor. lft, top, rgt, btm return pixel coordinates of monitor. If there are three monitors, the assumed configuration is with the second monitor on the left, the third on the right. |
-6 |
-2 |
Third monitor work area. lft, top, rgt, btm return pixel coordinates of monitor less task bar. |
-99 |
-2 |
Total virtual screen. lft, top, rgt, btm return pixel coordinates of the bounding rectangle for the combination of all the monitors. Note that in the case of multiple monitors, depending on their arrangement and configuration, there may be spaces within this rectangle which do not actually appear on any monitor. |
hg, vg (Num) [out]
These parameters, horizontal and vertical grid units, are applicable only when opflag = -1 (i.e. for query mode). When cid = -1, these return the screen resolution in pixels. Otherwise, they return the grid size, in universal units (0-10000) of the specified window or control. You can compare these grid values to the values returned in the lft, top, rgt, btm coordinates to determine sizes and positions in terms of row/column units.
monitors (Num) [out]
When opflag < 0, returns the number of monitors currently enabled. (You can then use opflag = -2 to retrieve information about individual monitors.)
winsts (Num) [out]
If specified with one of the query opflags, winsts will return one of:
Symbol |
Value |
Description |
---|---|---|
SW_HIDE |
0 |
Window is hidden |
SW_SHOWNORMAL |
1 |
Window is neither minimized nor maximized |
SW_SHOWMINIMIZED |
2 |
Window is minimized |
SW_SHOWMAXIMIZED |
3 |
Window is maximized |
Example:
! retrieve status of main window
xcall AUI, AUI_WINDOW, SW_QUERY, 0,0,0,0, 0,0, 0,0, 0, 0,0,0, winsts
switch winsts
case SW_HIDE
...
Examples
See the sample program AUIWIN [908,28]
Comments
When it comes to querying an individual control, the functionality of AUI_WINDOW overlaps that of AUI_CONTROL (with opcode CTLOP_INFO). In choosing between them, note that CTLOP_INFO returns coordinate information in logical millirows and columns, and relative to the parent of the control or window. These values will not be affected by moving the window or dialog around on the screen, or even resizing it. AUI_WINDOW, on the other hand, returns raw coordinate information, typically in "universal coordinates", relative to the desktop.
If using AUI_WINDOW to hide or display a control other than the main window, set cid to the name of numeric ID of the control, and set all the intervening parameters to 0, except tsts and bsts which should be set to -1. This functionality overlaps with that of AUI_CONTROL using opcode CTLOP_CHG.