Delphi Firemonkey Grid 组件滚动

Delphi Firemonkey Grid component scrolling

我正在使用 firemonkey Delphi。 我有一个网格组件和一个列表框内的几个编辑框,每个组件在列表框中占据自己的列表框项。我的问题是,当我滚动列表框并且我的鼠标移到网格组件上时,网格组件捕获我的鼠标滚轮滚动而不是列表框。我想要实现的是滚动功能保留在列表框中,并且仅在单击 it/cell 时滚动网格。如果我将 grid hittest 设置为 false,它可以正常工作,但是我该如何检测我的鼠标何时位于 grid 组件上以捕获任何 mousedown 事件以重新激活 Grid 以进行滚动?

这是我使用的表格

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 736
  ClientWidth = 636
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  object ListBox1: TListBox
    Align = Client
    Size.Width = 636.000000000000000000
    Size.Height = 736.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 1
    DisableFocusEffect = True
    DefaultItemStyles.ItemStyle = ''
    DefaultItemStyles.GroupHeaderStyle = ''
    DefaultItemStyles.GroupFooterStyle = ''
    Viewport.Width = 616.000000000000000000
    Viewport.Height = 732.000000000000000000
    object ListBoxItem1: TListBoxItem
      Size.Width = 616.000000000000000000
      Size.Height = 65.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 0
    end
    object ListBoxItem2: TListBoxItem
      Position.Y = 65.000000000000000000
      Size.Width = 616.000000000000000000
      Size.Height = 65.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 1
    end
    object ListBoxItem3: TListBoxItem
      Position.Y = 130.000000000000000000
      Size.Width = 616.000000000000000000
      Size.Height = 65.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 2
    end
    object ListBoxItem4: TListBoxItem
      Position.Y = 195.000000000000000000
      Size.Width = 616.000000000000000000
      Size.Height = 65.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 3
    end
    object ListBoxItem5: TListBoxItem
      Position.Y = 260.000000000000000000
      Size.Width = 616.000000000000000000
      Size.Height = 500.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 4
      object Grid1: TGrid
        Align = Client
        CanFocus = True
        ClipChildren = True
        Size.Width = 616.000000000000000000
        Size.Height = 500.000000000000000000
        Size.PlatformDefault = False
        TabOrder = 40
        Viewport.Width = 596.000000000000000000
        Viewport.Height = 475.000000000000000000
        object Column1: TColumn
        end
        object Column2: TColumn
        end
      end
    end
    object ListBoxItem6: TListBoxItem
      Position.Y = 760.000000000000000000
      Size.Width = 616.000000000000000000
      Size.Height = 65.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 5
    end
    object ListBoxItem7: TListBoxItem
      Position.Y = 825.000000000000000000
      Size.Width = 616.000000000000000000
      Size.Height = 65.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 6
    end
    object ListBoxItem8: TListBoxItem
      Position.Y = 890.000000000000000000
      Size.Width = 616.000000000000000000
      Size.Height = 65.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 7
    end
    object ListBoxItem9: TListBoxItem
      Position.Y = 955.000000000000000000
      Size.Width = 616.000000000000000000
      Size.Height = 65.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 8
    end
    object ListBoxItem10: TListBoxItem
      Position.Y = 1020.000000000000000000
      Size.Width = 616.000000000000000000
      Size.Height = 65.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 9
    end
    object ListBoxItem11: TListBoxItem
      Position.Y = 1085.000000000000000000
      Size.Width = 616.000000000000000000
      Size.Height = 65.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 10
    end
    object ListBoxItem12: TListBoxItem
      Position.Y = 1150.000000000000000000
      Size.Width = 616.000000000000000000
      Size.Height = 65.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 11
    end
  end
end

在设计器中设置属性Grid1.DisableMouseWheel := True

然后在 Grid1Click 上设置 Grid1.DisableMouseWheel := False

再次 ListBox1Click 设置 Grid1.DisableMouseWheel := True