delphivirtualtreeview

VirtualTreeView is not scrolling with mouse wheel


Using: Delphi 10.2.3 Tokyo, VCL Forms application, Windows 10 Pro, latest TVirtualStringTree

I have a TVirtualStringTree populated with many nodes, and the vertical scroll bar is visible. However, nothing happens when trying to scroll with the mouse wheel. Is there any setting that needs to be enabled, or does the control not support mouse wheel scrolling by default (ie. without writing any additional code in an event handler)?


Solution

  • There is no special setting in this component for that. It's just that your VirtualTreeView component doesn't get the MouseScroll Windows events.

    I had the same problem and in my case the underlying form/window has had an TApplicationEvents which got all Windows messages first (even if a new form with my VT component comes above) and set Handled = true.

    Within the OnMessage function of this TapplicationEvents I wrapped ...

    if ( ( MyVTForm == NULL ) || !MyVTForm->Visible ) {
    ...
    }
    

    ... around and it works now (sorry, C++ Builder code).