How do I access properties?

Properties of the window and the controls within it can be read and written from the callback functions in response to user actions.

Static properties (i.e. those that do not change while the window is running) can be accessed directly using the normal Lua table syntax.

Dynamic properties (i.e. those whose value may change) can be read or written using the prop() function. Its syntax is:

 

Value = m.prop(Control,[id.]PropertyName) --read a property

m.prop(Control,[id.]PropertyName,Value) --write a property

 

Control is a control as passed to a call back function from page() or a direct reference to any control table in an open window.

Id is the id of the control to be affected, if omitted or empty, self is assumed. When present it must match the 'id' field of some control in the window or be one of these special values (must be lower case):

window.id

to mean the window itself (e.g. 'mywindow' if the window.id property is 'mywindow')

'window'

to mean the window itself

'tabthis'

to mean the currently selected tab, i.e. 'self'

'tabback'

to mean the first enabled/visible tab before the current one, or self if there isn't one

'tabnext'

to mean the first enabled/visible tab after the current one, or self if there isn't one

No match throws an error. The id itself may not contain a '.' character. If there are multiple controls with the same id, which one is found is undefined.

PropertyName is the name of a property to be accessed. If the name is unknown an error is thrown.

Value is the value to set or returned. Its type is implied by the property.

If this function is called when the page is not being shown, an error is thrown. If the page is being shown, property changes are reflected in the page as well as in the control table(s).

When setting properties, the page is assumed to be the current Clarion TARGET (i.e. make sure you haven't opened a monitor in the callback!).

See the Callback Interface description above for the properties available.