TBoldComboBox¶
TBoldComboBox is a data-aware combo box that combines a current value display with a dropdown list of selectable values. It connects to both an element handle (current value) and a list handle (available choices).
Class Hierarchy¶
classDiagram
TCustomComboBox <|-- TBoldCustomComboBox
TBoldCustomComboBox <|-- TBoldComboBox
TBoldComboBox : +BoldHandle (current value)
TBoldComboBox : +BoldListHandle (choices)
TBoldComboBox : +BoldRowProperties
TBoldComboBox : +BoldSetValueExpression
click TBoldListHandle href "../TBoldListHandle/" "TBoldListHandle"
click TBoldExpressionHandle href "../TBoldExpressionHandle/" "TBoldExpressionHandle"
Key Properties¶
| Property | Type | Description |
|---|---|---|
BoldHandle |
TBoldElementHandle |
Current value handle |
BoldListHandle |
TBoldAbstractListHandle |
Available choices |
BoldProperties |
TBoldStringFollowerController |
Current value display |
BoldListProperties |
TBoldComboListController |
List behavior |
BoldRowProperties |
TBoldStringFollowerController |
How each row renders |
BoldSetValueExpression |
string |
OCL expression for mapping selection |
BoldSelectChangeAction |
TBoldComboSelectChangeAction |
What happens on select |
ReadOnly |
Boolean |
Prevent selection |
AutoSearch |
Boolean |
Type-ahead search in dropdown |
Working with TBoldComboBox¶
Selecting a Related Object¶
The most common use: selecting a related object from a list (e.g., choosing a Customer for an Order).
Form Designer Setup:
- Drop
TBoldComboBoxon a form - Set
BoldHandleto the current value (e.g., Order's customer reference) - Set
BoldListHandleto a list of choices (e.g., all Customers) - Set
BoldRowProperties.Expressionfor display text (e.g.,'name') - Set
BoldSetValueExpressionfor how selection maps to value
Example: Customer Selection¶
BoldComboBox1.BoldHandle → OrderExpressionHandle (expression: 'customer')
BoldComboBox1.BoldListHandle → CustomerListHandle (all customers)
BoldComboBox1.BoldRowProperties.Expression → 'name'
When the user selects a customer from the dropdown, Bold automatically sets the order's customer reference.
Selection Change Event¶
procedure TMyForm.ComboSelectChanged(Sender: TObject);
begin
// React to selection change
UpdateOrderDetails;
end;
BoldListProperties Options¶
| Property | Description |
|---|---|
NilElementMode |
How to handle nil (none, insert first, insert last) |
DragMode |
Drag behavior |
DropMode |
Drop behavior |
Setting NilElementMode to insert a nil element allows the user to clear the selection (choose "none").
See Also¶
- TBoldEdit - Simple text editing
- TBoldCheckBox - Boolean selection
- TBoldListHandle - Provides choices
- TBoldGrid - Grid with lookup columns