Summary:
See also: Classes and Objects, Windows and Forms, Form Class
The Window class is a built-in class providing an interface to the window objects.
ui.Window
Class Methods | |
Name | Description |
forName( name STRING ) |
Returns a Window object according to the name used in an OPEN WINDOW statement. |
getCurrent() |
Returns a Window object referencing the current window. |
Object Methods | |
Name | Description |
findNode( t STRING, n STRING ) |
Returns the first descendant DOM node of type t and matching the name n in the abstract representation of this form object. |
createForm( n STRING ) |
Creates an empty form and returns the new Form object. |
getForm() |
Returns a Form object to handle the current form. |
getNode() |
Returns the DOM representation of this Window. |
setText( t STRING ) |
Sets the title of this window object. |
getText() |
Returns the title of this window object. |
setImage( n STRING ) |
Sets the image for the icon of this window object. |
getImage() |
Returns the icon image of this window object. |
Windows are created with the OPEN WINDOW instruction, identifying the window by a static handle:
01
OPEN WINDOW w1 WITH FORM "customer"
You can get the window object corresponding to an identifier used in OPEN
WINDOW with the ui.Window.forName()
class method. You must declare a variable of type ui.Window
to hold
the window object reference:
01
DEFINE w ui.Window02
LET w = ui.Window.forName("w1")
The ui.Window.getCurrent()
class method returns a window object corresponding to the current
window. You must declare a variable of type ui.Window
to hold
the window object reference:
01
DEFINE w ui.Window02
LET w = ui.Window.getCurrent()
You can get a ui.Form instance of the current
form with the getForm()
method. This allows you to manipulate form
elements by program. You can, for example, hide some parts of a form with setElementHidden().
The getNode()
method returns the DOM node containing the
abstract representation of the window.
The findNode()
method allows you to search for a specific DOM node
in the abstract representation of the window content (i.e. the form). You
search for a child node by giving its type and the name of the element (i.e. the
tagname and the value of the
'name' attribute).
The createForm()
method can be used to create a new empty form.
The method returns a new ui.Form instance or NULL
if the form name passed as the parameter identifies an existing form used by the
window.
Use the setText()
method to define the title of the window. By
default, the title of a window is defined by the TEXT
attribute of the LAYOUT
definition in form files.
The getText()
method can be used to get the current title of a
window.
Use the setImage()
method to define the image to be used for the
icon of the window. By default, the icon image of a window is defined by the
IMAGE attribute of the
LAYOUT definition in form files.
The getImage()
method can be used to get the current icon image
of a window.
01
MAIN02
DEFINE w ui.Window03
OPEN WINDOW w1 WITH FORM "customer" ATTRIBUTE(TEXT="Unknown")04
LET w = ui.Window.forName("w1")05
IF w IS NULL THEN EXIT PROGRAM 1 END IF06
CALL w.setText("Customer")07
MENU "Test"08
COMMAND "exit"EXIT MENU
09
END MENU10
CLOSE WINDOW w111
END MAIN
01
MAIN02
DEFINE w ui.Window03
DEFINE f ui.Form04
OPEN WINDOW w1 WITH FORM "customer"05
LET w = ui.Window.getCurrent()06
IF w IS NULL THEN EXIT PROGRAM 1 END IF07
LET f = w.getForm()08
MENU "Test"09
COMMAND "hide" CALL f.setElementHidden("gb1",1)10
COMMAND "exit" EXIT MENU11
END MENU12
CLOSE WINDOW w113
END MAIN