Modifying a property at run time¶
The properties of a window or window object may be changed at run time by means of the constructions:
where property is the clause to be modified.
Field names and expressions may be used to provide values for property modification at run time.
If the xcreate | ycreate, winclass or menu label properties are changed at run time, the window or control must first be destroyed. Then make the changes required. When the object is next created the new values are used.
It is not necessary to destroy or re-create the window or object if any other properties are changed. If possible, Sculptor changes the property without destroying the control. Otherwise, if the control is currently in the created state, Sculptor destroys it and re-creates it with the new property value(s).
Modifications at group level may be made at any time, and are used the next time an object in the group is created.
Flag-type properties, several of which may be set at a time (such as Style, Edit mode) are added and removed at run time by means of the | (bitwise or) and &~ (bitwise and not) operators:
Adding a flag |
object_id->property = object_id->property | flag . |
Removing a flag |
object_id->property = object_id->property &~ flag . |
EXAMPLES
Add a maximise button to a window
Window4->style = Window4->style | WS_MAXBUTTON
Move a button’s create position to the right.
destroy Win3.Button2 Win3.Button2->xcreate = Win3.Button2->xcreate + 100
Change a table title
wintask.TimeTable->title = “Time table”
Specify that a menu item be initially disabled when next created. Note that this has no effect on the current state of the item. The enable and disable commands are used to change an item’s current state.
Menu1.Delete->style = Menu1.Delete->style | WS_DISABLED
Change a graphic image
Logo->image = “/images/logo2.bmp”
Disable multiple selections from a listbox by removing an edit mode flag
ListBox2->mode = ListBox2->mode &~ EM_MULTIPLE
RELATED TOPICS |