JVCL Help:TJvCustomComboBox
JVCL Help: TJvCustomComboBox Class
Search in JVCL Help
Search in all projectsClass Hierarchy
TJvCustomComboBox
TJvColorComboBox
TJvComboBox
TJvFontComboBox
run\JvCombobox.pas
Summary
Base class for provider aware combo boxes.
Pascal
run\JvCombobox.pas
TJvCustomComboBox = class(TJvExCustomComboBox);
Description
Use TJvCustomComboBox as a base class when defining new controls that represent a combo box and should use some of the new features introduced in this class. It is a direct descendant of TCustomComboBox.
TJvCustomComboBox provides the following additional features compared to the Borland TCustomComboBox:
- Automatic completion of entered text (only for Delphi 5, Delphi 6 and above already provides this feature).
- Making the control read-only.
- Searching for items by prefix, sub-string or by exact match, optionally case-sensitive.
- Delayed OnMeasureItem calling (see below).
- Hint color can be specified.
- Additional events added to react to mouse enter/leave, parent color changes or Ctl3D changes.
- Provider-aware.
Item measuringThe way TComboBox handles item measuring for owner-draw combo boxes is nearly useless: the OnMeasureItem event is called before the Canvas of the combo box can be used. As a result you can not really measure an item based on the Font of the control.
TJvComboBox publishes a new property MeasureStyle that can be used to specify the timing of the event. Using this event you can choose if the OnMeasureItem should be triggered as usual (cmsStandard), after the control is created (cmsAfterCreate) or before each item is rendered (cmsBeforeDraw).
Provider awarenessProvider-awareness for this control is done in the same way as for other provider-aware controls: a Provider property is added.
When a provider is selected, the component behaves slightly different from the normal case:
- Item measuring will never occur before the Canvas is usable (i.e. MeasureStyle set to cmsStandard behaves the same as cmsAfterCreate).
- If the Style property is not set to an owner draw style, the combo box is created as a variable height combo box (i.e. only csOwnerDrawFixed results in a fixed height combo box).
- If the Style property is set to an owner draw style and the OnMeasureItem or OnDrawItem events are assigned, these events will execute in favor of the provider based measuring/rendering. In all other cases, the provider based measuring/rendering will be used.
Do not create instances of TJvCustomComboBox. To put a combo box in a form, use a descendant of TJvCustomComboBox, such as TJvComboBox.
About
Contribute to this help topic
This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page