【问题标题】:Right-click only to select a node in VirtualTreeView?仅右键单击以选择 VirtualTreeView 中的节点?
【发布时间】:2020-07-25 22:23:32
【问题描述】:

我只需要右键选择virtualstringtree的一个节点,左键不应该选择该节点。但我找不到解决方案。打开选择,也将允许左键单击并选择一个节点。 虚拟字符串树可以做到这一点吗?

【问题讨论】:

    标签: delphi tvirtualstringtree


    【解决方案1】:

    要在right-click 上启用选择,请在SelectionOptions 中设置toRightClickSelect

    VST1.TreeOptions.SelectionOptions := VST1.TreeOptions.SelectionOptions + [toRightClickSelect];
    

    为了防止在鼠标left-click 上进行选择,一种选择是在OnMouseDown 事件中使用Abort

    procedure TForm1.VST1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    begin
      if Button = mbLeft then // only Abort if mouse left-button is pressed down
        abort;
    end;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-21
      • 1970-01-01
      • 2013-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多