ThisWindow
ThisWindow
A data structure that provides information about the state of the system and of the current window at the time of the last event in that window.
The ThisWindow data structure provides information about the state of the system and of the current window at the time of the last event in that window.
The ThisWindow structure contains a number of fields that are reset when the current window changes. By trapping these values, the application enables the user to change the current window and later return to pick up where things were left.
If the current window is non-modal, note that the last event in the window is not necessarily the last event in the interface overall.
The fields in the ThisWindow structure are
AltKey, CtrlKey, ShiftKey, EventName, EventTag, EventType, KeyPressed, MouseClick, ScrollingKey, WindowCol, WindowHeight, WindowName, WindowNum, WindowRow, WindowState, WindowTag, WindowWidth
Syntax #1 – AltKey, CtrlKey, ShiftKey
The state of the Alt, Ctrl or Shift key at the time of the last event in the current window.
thiswindow.altkey
thiswindow.ctrlkey
thiswindow.shiftkey
Return Value
“1” ($True), or “0” ($False), character string (binary). Can be reset by an application program.
Description
The variables indicate the state of the Alt, Ctrl and Shift keys at the time of the last event in the current window.
Each variable is set to ‘1’ ($True) if the corresponding key was down when the last event in the current window occurred. Otherwise, each is set to ‘0’ ($False).
Syntax #2 – EventName
Identifies the last event that occurred in the current window.
thiswindow.eventname
One of
Break, Canceled, Click, Closed, DoubleClick, GotFocus, HangUp, LostFocus, LostFocusModified, Modified, PanicExit, Timeout, WindowFocusSwitch, or keyname
Cannot be reset by an application program.
Return Value
Character string (alpha). Can be reset by an application program.
Description
Identifies, by name, the last event to occur in the current window.
This variable is not set in all operating environments.
ThisWindow.EventType gives additional information about the type of event, and ThisWindow.EventTag gives additional information about the type of object involved in the event.
Syntax #3 – EventTag
Identifies the tag of the object in which the last event in the current window occurred.
thiswindow.eventtag
Return Value
The identification tag of the object in which the last event in the current window occurred. Can be reset by an application program.
Description
Identifies the object in which the last event in the current window occurred.
The identification tag selected varies with the type of object involved in the event.
ThisWindow.EventName names the event, and ThisWindow.EventType gives additional information about the type of event.
Can be, depending on the type of object involved
EventType Type | Source for EventTag Value |
Window | Event.WindowTag |
Menu | Event.MenuTag |
Menuitem | Event.MenuItemTag |
Form | Event.FormTag |
Formfield | Event.FieldTag |
Accelerator | Event.FieldTag |
System | Event.FieldTag |
Syntax #4 – EventType
Identifies the type of event that last occurred in the current window.
thiswindow.eventtype
One of
Window, Menu, MenuItem, Form, FormField, Accelerator, System
Return Value
Character string (alpha). Can be reset by an application program.
Description
Identifies the type of event that last occurred in the current window. ThisWindow.EventName names the event, and ThisWindow.EventTag identifies the object in which the event occurred.
Syntax #5 – KeyPressed
Indicates the key that, pressed, caused the event that last occurred in the current window.
thiswindow.keypressed
Return Value
Character string (alpha). Can be reset by an application program.
Description
The name of the key that, pressed by the application user, caused the last event to occur in the current window. Can be reset by an application program.
For example, if the application user presses the a key in a form field and the Modified event is intercepted by the application program, then ThisWindow.KeyPressed is set to “a”.
Note: The name of the key that caused an accelerator event is recorded in the ThisWindow.EventName variable.
Syntax #6 – MouseClick
Indicates if a mouse button accelerator caused the event that last occurred in the current window.
thiswindow.mouseclick
Return Value
“1” ($True), or “0” ($False). Can be reset by an application program.
Description
Set to “1” ($True) if the last event to occur in the current window was caused by the press of a mouse button that is defined as an accelerator for the window. Otherwise, set to “0” ($False).
If SET MOUSE is OFF, ThisWindow.MouseClick is 0.
Syntax #7 – ScrollingKey
Indicates if the accelerator that caused the event that last occurred was also a defined SCROLL key.
thiswindow.scrollingkey
Return Value
“1” ($True), or “0” ($False). Can be reset by an application program.
Description
Set to “1” ($True) if the accelerator key that caused the last event in the current window was also a defined SCROLL key. Otherwise, set to “0” ($False).
Example
window set scroll Up up Down down
window set accelerator up down escape
form open fEmployee
form set scroll fEmployee from EmpSet
form display
while
if thiswindow.scrollingkey = $true
change EmpSet from fEmployee
form scroll
continue
endif
… other commands …
endwhile
In the preceding code fragment, employee records are scrolled through a form and the application user can update the data. ThisWindow.ScrollingKey detects if a scrolling key was pressed, enabling the scrolling action to be performed under program control after any changes to the data are saved.
Syntax #8 – ScrollingKey
thiswindow.scrollingkey
Return Value
Character string (binary). Can be reset by an application program.
Description
The variable indicates if the accelerator that cased the event that last occurred was also a defined SCROLL key.
ThisWindow.ScrollingKey is set to ‘1’ ($True) if the accelerator that caused the last event in the current window was also a defined SCROLL key. Otherwise, it is set to ‘0’ ($False).
Syntax #9 – WindowCol, WindowRow
The character column or row position of the current window.
thiswindow.windowcol
thiswindow.windowrow
Return Value
A number. Cannot be reset by an application program.
Description
The variables indicate the physical size of the current window in character rows (WindowHeight) and character columns (WindowWidth).
The physical dimensions of a window determine the visible space inside the window (i.e., the client area). This area changes in size when the dimensions of the window change. An application user can change the size of a window by using the resize feature. A program can change the size of a window using the WINDOW SIZE command.
An application program can position a window using the WINDOW MOVE command.
Syntax #10 – WindowHeight, WindowWidth
The physical height or width of the current window in character rows.
thiswindow.windowheight
thiswindow.windowwidth
Return Value
Number (INT). Cannot be reset by an application program.
Description
The variables indicate the physical size of the current window in character rows (WindowHeight) and character columns (WindowWidth).
The physical dimensions of a window determine the visible space inside the window (i.e., the client area). This area changes in size when the dimensions of the window change. An application user can change the size of a window by using the resize feature. A program can change the size of a window using the WINDOW SIZE command.
Syntax #11 – WindowName
The name of the current window.
thiswindow.windowname
Return Value
A character string. Can be reset by an application program.
Description
The variable identifies, by name, the current window.
Example
You can use ThisWindow.WindowName to restore the focus to a window, making it the current window:
let SaveWin = ThisWindow.WindowName
window open Window2
… other commands …
window set current SaveWin
Syntax #12 – WindowNum
The identification number of the current window.
thiswindow.windownum
Return Value
A number. Can be reset by an application program.
Description
The variable identifies, by identification number, the current window.
Syntax #13 – WindowTag
thiswindow.windownum
Return Value
Character string (alpha). Can be reset by the application program.
Description
The variable identifies, by identification tag, the current window.
Syntax #13 – WindowState
Indicates whether the current window is maximized, minimized, or otherwise.
thiswindow.windownum
Return Value
A number. Cannot be reset by an application program.
Description
Indicates the state of the current window at the time of the last event in that window.
Value | Meaning |
-1 | The current window is minimized. |
0 | The current window is neither minimized nor maximized. |
1 | The current window is maximized. |
See Also