Workbench User Guide : Creating and Using Basic Fields : Scalar Fields : Option Fields
 
Share this page          
Option Fields
An option field appears as a drop-down list of values from which the end user can make one selection. Only the current value is displayed. In addition to selecting the current value, the end user can click the down arrow to select another value from the drop-down list.
An option field has an inner border and an external border. The inner border is either on or off depending on the setting of the InnerShadowWidth property. If the inner shadow width is LW_NOLINE, the inner border is turned off; otherwise it is on.
The external border depends on the outline width setting. When the outline width is set to LW_MINIMUM, the external border is identical to the inner border. The exception to this is when the TextLabel property contains a string. In this case, the external border encloses the text label also.
Note:  For information about modifying the list of available options, see Add and Delete List Field Items.
Create an Option Field
You can create an option field on a form.
To create an option field
1. Open your frame in the Frame Editor (see Open an Existing Frame).
2. Select the Option Field icon on the field palette.
3. Place the option field on the form.
4. Set the properties for the option field, including ExactWidth or MinimumWidth, InnerShadowWidth, Style, VisibleRows, and ValueList.
Note:  For complete descriptions of each field property, see Option Field Properties and Common Field Properties.
Option Field Properties
All the properties for option fields are described under Common Field Properties, with the exception of the following properties that are specific to the option field type:
ExactWidth
Specifies the exact outer width of the field. If both MinimumWidth and ExactWidth are positive, ExactWidth takes precedence. If both MinimumWidth and ExactWidth are 0, the default width will be just big enough to hold the largest item in the field.
Default: 0
InnerShadowWidth
Specifies the width of the shadow surrounding the text value. Valid options are:
LW_DEFAULT
LW_THIN
LW_NOLINE
Default: LW_DEFAULT
MinimumWidth
Specifies the minimum outer width of the field. If it is smaller than the smallest width of the items in the field, the largest width of the items is used.
Default: 0
Style
Indicates whether the option field's values are editable. Valid options are:
OF_NORMAL
Specifies that the option field takes on only the values specified for the ValueList property
OF_EDITABLE
Specifies that the end user can enter a value, which then becomes the current value of the field and is displayed in the option field. This value, however, is not added to the actual list of values.
Default: OF_NORMAL
VisibleRows
Specifies the number of rows displayed in the drop-down list
Default: 0
Note:  If this value is set to something less than the total number of rows, a scroll bar is automatically provided to allow access to the other rows. Otherwise, all the rows will be displayed with no scroll bars.