VirtualTrees.pas
includes the following declaration in the TBaseVirtualTree
class:
private
procedure CMMouseWheel(var Message: TCMMouseWheel); message CM_MOUSEWHEEL;
The component author captured the mouse wheel messages so he could first scroll vertically and then horizontally. The custom code is the reason that the mouse wheel messages are being sent to the TVirtualStringTree
instead of the TComboBox
. I commented out his code and the TComboBox
drop-down list scrolled as expected.
Since I really don't want to remove the TBaseVirtualTree
code, I created my own TMyComboBox
with the following code to use as the in-place editor. Now scrolling works correctly in both the drop-down list and in the tree control.
interface
type
TMyCombBox = class(TComboBox)
private
procedure CMMouseWheel(var Message: TCMMouseWheel); message CM_MOUSEWHEEL;
end;
implementation
procedure TMyComboBox.CMMouseWheel(var Message: TCMMouseWheel);
begin
if DoMouseWheel([], Message.WheelDelta, SmallPointToPoint(Message.Pos)) then
Message.Result := 1;
end;
This captures the CM_MOUSEWHEEL
message before it is passed to the tree control and hands it to the TControl.DoMouseWheel()
method to process.