Setting Properties in Script

You can dynamically set widget properties at runtime using ProcScript, or for dynamic server pages, in JavaScript.

Properties set in script override properties set declaratively or in the application initialization file.

Setting Widget Properties in ProcScript

Uniface provides ProcScript functions that enable you to get and set properties of widgets and windows. You can also define and set custom properties that you use for your own purposes.

Note:  The ProcScript functions only return properties that have been explicitly set, either by a previous ProcScript function, or declaratively in the Uniface IDE. If only default values are being used, the ProcScript functions return an empty string.

ProcScript for Widget and Window Properties
Widget ProcScript Purpose
Application shell widget $applproperties Gets or sets the dynamic properties of the application shell. These are the properties that control the background color and background image.
Form component $windowproperties Get or set the current window properties of a component instance.

Note: Although you can use this command with any component, Uniface only responds if the instance is a Form.

Entity widget $entityproperties Gets or sets the widget properties of an entity.
$CurEntProperties Gets or sets the current presentation properties of a specific inner entity occurrence.
Occurrence widget $occproperties Gets or sets the properties of an occurrence.
$curoccvideo Gets or sets the video properties for fields of the current occurrence.
Field widgets $properties Gets or sets the initial or default widget properties of a field.
$fieldproperties Gets or sets the widget properties of an instance of a specified field.
$paintedfieldproperties Gets or sets the current position and size for a specific instance of a field widget.
Labels $labelproperties Gets or sets the text of an associated label.

Setting Widget Properties in JavaScript

In Dynamic Server Pages it is often preferable to change the values of widget properties using JavaScript rather than ProcScript. Many changes are cosmetic rather than data-related so there is no need to go back to the server to make the change. Since widgets are rendered in the client browser, using JavaScript reduces the network traffic between the web server and client browser. For more information, see Executing Logic in the Browser and APIs: JavaScript.

To set widget properties in a dynamic server page using JavaScript, define a weboperation or webtrigger, and in the javascript block obtain the object and use the appropriate members to set, get, and clear the object's properties.

JavaScript API Functions for Widget Properties
Member Purpose
clearProperties() Restores the initial widget properties of the object.
clearProperty() Restores the initial value of the specified widget property.
getProperties() Returns the widget properties of the object
getProperty() Returns the value of a widget property of the object
setProperties() Sets one or more widget properties for the object.
setProperty() Sets the specified widget property for the object to a given value.