Changes Made to DD Field Options are Now Dynamic
A frequent request has been to make Data Dictionary field settings more dynamic. When a change is made for a field in a DDO (e.g., a retain option, a field mask), the change should be immediately reflected in all data entry objects that use that field. Prior to version 8.1, a DEO acquired DDO field option information when the DEO was activated. If these DDO field options changed after the DEO was activated, the DEO was not notified of this change. Now they are.
Some field settings were already fully dynamic. For example, changes in field prompts, zooms, entry, exit, and validate messages were immediately reflected by the DEO (or more accurately, the DEO always handled these by using the DDOs). The areas that were not fully dynamic prior to VDF 8.1 were field options, field masks, and field labels.
Dynamic Field Options
Field options such as dd_zero_suppress and dd_retain are now dynamic. If they are changed, the DEOs will immediately use those changes. The options can be set, cleared, and toggled by using three new DD messages:
file_field_optionfile_field_option_clearfile_field_option_toggle
The old DD message file_field_options is still used to set the class defaults inside of define_fields (which is usually created for you by Database Builder), but they cannot be used to set options dynamically.
Dynamic options will most often be changed at the object level, and not at the DD class level.
As an example, let’s say that you wanted to change your customer view so you could choose to "lock" the field values for City, State, and Zip. The idea here is that you will set these to the values you want, press a key, and lock them - the field will be non-enterable and the value will be retained. Then when needed, you could unlock those values, change them, and if needed, lock them again. To do this, you add the following code to your dbView object. Assume we will use Ctrl+L to lock and Ctrl+U to unlock.
On_key key_ctrl+key_L send LockFields // these messages will delegate to here
On_key key_ctrl+key_U send UnLockFields
Procedure LockFields Handle hoCustomerDD
Move Customer_DD to hoCustomerDD // object id of customer DD
set File_field_Option of hoCustomerDD file_field customer.state to (DD_RETAINALL IOR DD_NOENTER)
set File_field_Option of hoCustomerDD file_field customer.City to (DD_RETAINALL IOR DD_NOENTER)
set File_field_Option of hoCustomerDD file_field customer.Zip to (DD_RETAINALL IOR DD_NOENTER)
End_procedure
Procedure UnLockFields Handle hoCustomerDD
Move Customer_DD to hoCustomerDD // object id of customer DD
set File_field_Option_Clear of hoCustomerDD file_field customer.state to (DD_RETAINALL IOR DD_NOENTER)
set File_field_Option_Clear of hoCustomerDD file_field customer.City to (DD_RETAINALL IOR DD_NOENTER)
set File_field_Option_Clear of hoCustomerDD file_field customer.Zip to (DD_RETAINALL IOR DD_NOENTER)
End_procedure
The one exception to dynamic changes in DD options is DD_Capslock. While the DEO is notified of the change, the control will not reflect this change until it is unpaged and paged. This is a limitation of the Windows control.
Dynamic Field Masks
If a DDO field has a mask type assigned to it, changing the mask value with set file_field_mask will be reflected immediately by the DEOs. Also, changing the zero-suppress field option (DD_Zero_Suppress) will also be immediately reflected in your DEOs. Changing the mask value only affects DEOs that have been assigned a mask window type by the DDO (or possibly the DEO). By default, Database Builder assigns the proper masked data types for fields, which means that dates and numbers will have masks.
You cannot dynamically change the data type of a window (for example, you cannot use set file_field_type to change a DEO from a string to a date). Like DD_Capslock, this would require that you "page" and "unpage" a window, and it is assumed that there is little need for this feature.
Dynamic Labels
If you change the long or short label of a DDO field using set field_label_long or set field_label_short, your DEOs will be notified of this change. If the DEOs support auto-labels (where auto_label_state in the DEO is true; by default, it is false), the label will be automatically updated. Grid objects will update short label names as column labels, while all forms will update long label names.
DEO Notification Process
The following messages are sent to active DEOs to notify them that an option, mask, or label has been changed by a DEO.
Procedure File_Field_Option_Changed integer iFile integer iField integer iOptions integer bClear
Procedure File_Field_mask_Changed integer iFile integer iField string sMask
Procedure File_Field_Label_Changed integer iFile integer iField boolean bLong string sLabel
It is not expected that you would ever want or need to augment these messages. If you do, we suggest you look at the package DD_Deomx.pkg and study the existing methods.