10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

VariablesFor example, assume that you create an entry field and enter the variablename as title. You can set the value in that field with the following statement:title = 'Destry Rides Again';It is not necessary to declare field and menu item variables in your scripts;OpenROAD declares them automatically when you create the field or menuitem in the OpenROAD Workbench.To reference the object represented by a field or menu item instead of itsvalue, use the field function, as described in Field Function (see page 65), withthe field or menu item variable. For example, the following statement changesthe background color of the previously described entry field:field(title).bgcolor = CC_ORANGE;For more information about the field function, see Field Function (seepage 65).How You Can Initialize VariablesWhen OpenROAD starts an application, any global variables associated withthe application are initialized. Similarly, when you call a frame or procedure,OpenROAD initializes the variables associated with the frame or procedure.OpenROAD uses the default value of the variable as the initial setting. For fieldand menu items or global variables, you can define this value in theOpenROAD Workbench. If you do not, OpenROAD uses the system defaults.OpenROAD also uses the system default for variables declared in the initializestatement of a frame script.For simple variables, the system defaults are zero for numeric data types, orthe empty string ('') for non-nullable character data types. However, you canoverwrite these defaults using the default clause, for example:i = integer not null default 3;For reference variables, OpenROAD creates an object of the declared class andsets the reference variable to reference that object. The attributes of thisobject are initialized to their default values (which are specified in the classdefinition). For attributes that are reference variables, you can set the initialvalue of the variable to null. In this case, no object is created for the referencevariable.34 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!