Contact Us
- Sales: sales@todaysystems.com
- Support: support@todaysystems.com
Tutorial: Controlling Display Only Fields
Introduction
BuildProfessional has long provided a concept of a display-only field. The latest 8.03 versions allow the developer to specify the type of display field and which colors are to be used for those fields.
Background
Display-Only edit fields are typcially of two types:
-
Non-selectable. The classic display field (inherited from Version 5). These fields are non-selectable. These are the type of field which is created by a FIELD *DISPLAY. A drawback with these fields is that the foregroud color is always light grey (control by Windows).
- Non-editable. In newer projects, developers use a selectable, but non-editable field. The advantage is that the user can focus on the field, scroll horizontally and copy the value into the clipboard. It was previously not possible to make this field editable at runtime.
Ideally developers have wanted the ability to use non-editable fields that can be switched to editable at runtime AND with distinct color settings.
New Environmental Settings
The following settings can be in the [TODAY Environment] of the BuildProfessional configuration file (wintoday.ini / .todayrc):
DisplayInputSettings=True
On FIELD *DISPLAY, sets the edit field to non-editable rather than non-selectable.
DisplaySettingBrush=solid-red
DisplaySettingBg=green
DisplaySettingFg=blue
InputSettingBrush=solid-green
InputSettingBg=red
InputSettingFg=white
Colors and brush to use for edit fields upon FIELD *DISPLAY / FIELD *INPUT.
The following existing configuration values also affect colors:
EditSelectableNoBg
EditSelectableNoBrush
EditSelectableNoFg
EditEditableNoBg
EditEditableNoBrush
EditEditableNoFg
Implement in Code
To make use of this functionality more dynamically, set the environment variables at runtime. The following values provide a more reasonable color combination:
*ENV("DisplayInputSettings") = "True"
*ENV("DisplaySettingBrush") = "XP_COLOR_ACTIVEBORDER"
*ENV("DisplaySettingBg") = "XP_COLOR_ACTIVEBORDER"
*ENV("DisplaySettingFg") = "blue"
*ENV("InputSettingBrush") = "XP_COLOR_3DFACE"
*ENV("InputSettingBg") = "XP_COLOR_3DFACE"
*ENV("InputSettingFg") = "XP_COLOR_WINDOWTEXT"
*ENV("EditSelectableNoBg") = "XP_COLOR_ACTIVEBORDER"
*ENV("EditSelectableNoFg") = "blue"
*ENV("EditSelectableNoBrush") = "XP_COLOR_ACTIVEBORDER"
*ENV("EditEditableNoBg") = "XP_COLOR_ACTIVEBORDER"
*ENV("EditEditableNoFg") = "blue"
*ENV("EditEditableNoBrush") = "XP_COLOR_ACTIVEBORDER"
Example Application
Try the dispdemo application for an example.
Warning
If you are moving from traditional display type fields (non-selectable), to selectable non-editable fields beaware that exist before and after field events could occur. So when moving switching the field properties, check if there is an event on the field and evaluate the effects of making the field selectable.