User-defined properties allow IDL programmers to provide their own custom means for editing a property. One significant difference from other types of properties is that user-defined properties must have a string version of their value. This string value is stored in the USERDEF attribute of the property and must be explicitly updated. The string value is the value displayed in the property sheet.
Updating User-defined Properties
Like other property types, user-defined properties generate IDL property sheet change events. The difference is that the IDL event handler cannot query the property sheet for the new value. It must use some other means to determine a new value. Typically this is done through widget code, in which the user is asked to set a value, but virtually any other technique is valid.
When handling change events, determine the property’s type using the PROPTYPE field of the widget event structure. Once a value has been acquired, update the component using its SetProperty method. In addition, the string version of the user-defined property’s value should be updated. This is done by executing a statement similar to the following example:
eventBase.identifier, USERDEF = userDefValue
where eventBase is the event structure of the top-level-base and userDefValue is the string representing the user-defined value when the property sheet is refreshed.
Once the underlying component has been updated, the property sheet is ready to be refreshed. Execute a call to update a given property with the current value:
WIDGET_CONTROL, propsheet, REFRESH_PROPERTY = eventBase.identifier
where propsheet is the widget ID of the property sheet widget and eventBase is the event structure of the top-level-base.