Search code examples
c++buildervcl

How to scroll the picklist on a TValueListEditor with the mousewheel?


By default, the mousewheel will change rows on the TValueListEditor. When I have a picklist, I would prefer for the mousewheel to scroll the displayed list instead. I know how to override the default behavior, but how do I gain access to the object controlling the display of the dropdown list so that I can tell it to scroll?


Solution

  • TValueListEditor has InplaceEditor and EditList properties that return a pointer to a TInplaceEditList object (the InplaceEditor property returns a TInplaceEdit* pointer, which you can type-cast to TInplaceEditList*). Both properties are declared as protected, so you will have to use an accessor to reach them, or derive from TValueListEditor so you can promote their visibility.

    In either case, TInplaceEditList has a public PickList property that returns a pointer to a TCustomListBox object (it is actually a TPopupListBox).