Built-in Classes

Included in the predefined functions that are built into Genero are special groups (classes) of functions (methods) that act upon the objects that are created when your program is running. Each class of methods interacts with a specific program object, allowing you to change the appearance or behavior of the objects. Because these methods act upon program objects, the syntax is somewhat different from that of functions.

The classes are gathered together into packages:

This tutorial focuses on using the classes and methods in the ui package to modify the user interface at runtime.

Note: Variable names, class identifiers, and method names are not case-sensitive; the capitalization used in the examples is for ease in reading.

Using the Classes

This example for the Window class also presents the general process that you should use.

The methods in the Window class interact with the Window objects in your program.

Getting a reference to the object

Before you can call any of the methods associated with Window objects, you must identify the specific Window object that you wish to affect, and obtain a reference to it:

Calling a method

Now that you have a reference to the object, you can use that reference to call any of the methods listed as object methods in the Window class documentation. For example, to change the window title for the window referenced by mywin:
CALL mywin.setText("test")

See The Window class in the Genero Business Development Language User Guide for a complete list of the methods in this class.

Example 1

01 MAIN
02 DEFINE mywin ui.Window 
03              
04 OPEN WINDOW w1 WITH FORM "testform"
05 LET mywin = ui.Window.getCurrent()
06 CALL mywin.setText("test")
07 MENU
08  ON ACTION quit 
09    EXIT MENU
10 END MENU
11
12 END MAIN
This figure is a screenshot of a window with the title set to "test" by the ui.Window.setText method.

Figure 1. Form with window title changed by the ui.Window.setText method