0
votes

I have several TStringGrid components in a frame. I would like to disable the mouse scroll wheel for a TStringGrid component, but enable it for the frame, so that when the mouse wheel is moved, the frame scrolls up or down, instead of changing the cell selection in the grid.

I tried setting adding empty methods for OnMouseWheelDown and OnMouseWheelUp for each of the TStringGrid components (this didn't work).

enter image description here

1
If I set the Enabled property for the TStringGrid components to false, this disables the scroll wheel for grid, but the wheel does not control the scroll bar for the frame.rebecca

1 Answers

0
votes

Modify the OnMouseWheel event handler on the frame:

void __fastcall TFrameNameOfFrame::FrameMouseWheel(TObject *Sender, TShiftState Shift,
          int WheelDelta, TPoint &MousePos, bool &Handled)
{

    this->VertScrollBar->Position += WheelDelta;

}