From VistApedia
Jump to: navigation, search

CPRS Delphi Controls Stuff

TORComboBox Example

TORComboBox is very similar to the standard TComboBox. However, it is not derived from TComboBox. Instead, it is derived from TWinControl and encapsulates TEdit and TORListBox controls. It supports the properties of TComboBox in addition to the TORListBox shown above. Also, TORComboBox does partial matches on the list as the user types, rather than just accepting free text into the box. Some properties are handled a little differently and are listed below. At the current time a dropdown list will not drop ‘up’ when the combobox is at the bottom of the screen (fairly easily remedied but not a high priority).

TORComboBox Property Exceptions

  • Items The items property works the same as TComboBox except that it is available only at runtime, due to some differences in how the IDE handles compound components at design time. This should be remedied in the future.
  • Style The only styles allowed are orcsSimple and orcsDropDown. The ‘or’ was prepended to prevent conflicts with the regular TComboBox styles. The owner-draw versions of these styles is not supported at this time.
  • OnKeyPause This event is called in response to keyboard Actions. When the user pauses typing for 500 milliseconds, this Action is called. This can be used similar to an OnKeyPress event, except the delay allows the user to enter more that one character before the event is called. This is useful for expensive calls (like network calls) in response to keyboard Actions.
  • OnMouseClick This event differs from the Click event in that it is only called when the mouse (not the keyboard) is used to make a selection. (It is really triggered by the listbox MouseUp event). It can be used in conjunction with the OnKeyPause event to do processing whenever a combobox changes.

TORComboBox Properties - Future Enhancements

  • ListOnly A boolean property which would disallow any text entry in the edit box that did not match an item in the list.
  • GlobalRef A property that would optionally allow the combobox to be tied directly to a cross-reference on a server for lookup.