ComboBox Control
The ComboBox control displays a drop-down list of predefined values and an edit field into which the user can enter a value. To associate this control with a string or integer property, enter the property's name in the Property column of the Control table.
Control Attributes
You can use the following attributes with this control. To change the value of an attribute using an event, subscribe the control to a ControlEvent in the EventMapping table and list the attribute's identifier in the Attribute column. Enter the identifier of the ControlEvent in the Event column.
Attribute identifier | Hexadecimal bit | Description |
---|---|---|
IndirectPropertyName | This is the name of an indirect property associated with the control. If the Indirect attribute bit is set, the control displays or changes the value of the property having this name. If the Indirect attribute bit is set, this name is also the value of the property listed in the Property column of the Control table. | |
Position | Position of the control in the dialog box. Enter the control's width, height, and coordinates of the control's left corner into the Width, Height, X, and Y columns of the Control table. Use installer units for length and distance. |
|
PropertyName | This is the name of the property associated with this control. If the Indirect attribute bit is not set, the control displays or changes the value of the property having this name. This attribute is specified in the Property column of the Control table. | |
PropertyValue | The current value of the property displayed or changed by this control. If the Indirect attribute bit is not set, this is the value of PropertyName. If the Indirect attribute bit is set, this is the value of IndirectPropertyName. If the attribute changes, the control reflects the new value. | |
Text | To set the font and font style of a text string, prefix the string of displayed characters with {\style} or {&style}. Where style is an identifier listed in the TextStyle column of the TextStyle table. If neither of these are present, but the DefaultUIFont property is defined as a valid text style, that font will be used. To specify the number of characters the user can enter, append {n} after any font specifications, where n is a positive integer. |
|
Visible | 0x00000000 0x00000001 |
Hidden control. Visible control. Include this bit in the bit word of the Attributes column in the Control table to make the control visible or hidden upon its creation. You can also hide or show a control by using the ControlCondition table. |
Enabled | 0x00000000 0x00000002 |
Control in a disabled state. Control in an enabled state. Include this bit in the bit word in the Attributes column of the Control to enable the control on creation. You can also enable or disable a control by using the ControlCondition table. |
Sunken | 0x00000000 0x00000004 |
Displays the default visual style. Displays the control with a sunken, 3-D, look. Include these bits in the bit word in the Attributes column of the Control table. |
Indirect | 0x00000000 0x00000008 |
The control displays or changes the value of the property in the Property column of the Control table. The control displays or changes the value of the property that has the identifier listed in the Property column of the Control table. Determines if the property associated with this control is referenced indirectly. |
Integer | 0x00000000 0x00000010 |
Property associated with the control is a string value. Property associated with the control is an integer value. Include this bit in the bit word of the Attributes column of the Control table to set this attribute on creation of the control. |
RTLRO | 0x00000000 0x00000020 |
Text in the control is displayed in left-to-right reading order. Text in the control is displayed in right-to-left reading order. |
RightAligned | 0x00000000 0x00000040 |
Text in the control is aligned to the left. Text in the control is aligned to the right. |
LeftScroll | 0x00000000 0x00000080 |
The scroll bar is located on the right side of the control. The scroll bar is located on the left side of the control. |
BiDi | 0x000000E0 | Set this value for a combination of the RTLRO, RightAligned, and LeftScroll attributes. |
Sorted | not set 0x00010000 |
Items displayed in alphabetical order. Items displayed in order specified in the ListView table. The control queries the ComboBox table, and if the Sorted style bit is set, the ComboBox has the CBS_SORT style and displays items as specified by Ordering. If this style bit is not set, items are displayed in alphabetical order. |
ComboList | not set 0x00020000 |
Combo box with edit field. Combo box with edit field is replaced by a static text field. |
UsersLanguage | 0x00000000 0x00100000 |
Fonts created in the database code page. Fonts created in the user's default UI code page. |
Remarks
This control can be created from the COMBOBOX class by using the CreateWindowEx function. It has the CBS_AUTOHSCROLL, WS_TABSTOP, WS_GROUP, and WS_CHILD styles. If the ComboList bit is on, it also has the CBS_DROPDOWNLIST style, otherwise it has the CBS_DROPDOWN style.
The length of the text that can be entered can be limited by putting a number from 0 to 2147483646 in curly braces at the beginning of the Text field in the Control table. For example if the text field starts with {80}, the length of the string is limited at 80 characters. If no such limit is supplied in the table, or if 0 is specified, the length is set to the maximum possible (2147483646 characters). A negative or non-numeric value will generate an error.
For compatibility with screen readers, when authoring a dialog box with a ComboBox control as the first active control, you must make the text field belonging to the edit field the first active control in the Dialog table. Since the static text cannot take focus, when the dialog box is created, the edit field will have the focus initially as intended. Doing this ensures that screen readers show the correct information.