Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double click on cell reverts focus to VT when custom combobox editor is showed with DroppedDown:=True; #1216

Open
gmnevton opened this issue Sep 6, 2023 · 1 comment
Labels
Open for Discussion There are several possibilites to address the issue and anyone is invited for comments. Repro Steps Missing A smple project is needed to reprodcue and analyze the issue. See our guidelines for opening issues!

Comments

@gmnevton
Copy link

gmnevton commented Sep 6, 2023

Hi, excluding csCaptureMouse from ControlStyle solves the problem.

procedure TBaseVirtualTree.WMLButtonDblClk(var Message: TWMLButtonDblClk);

var
  HitInfo: THitInfo;
  wasCaptureMouse: Boolean;

begin
  DoStateChange([tsLeftDblClick]);
  try
    // get information about the hit, before calling inherited, is this may change the scroll postion and so the node under the mouse would chnage and would no longer be the one the user actually clicked
      GetHitTestInfoAt(Message.XPos, Message.YPos, True, HitInfo);
      HandleMouseDblClick(Message, HitInfo);
    // Call inherited after doing our standard handling, as the event handler may close the form or re-fill the control, so our clicked node would be no longer valid.
    // Our standard handling does not do that.
    wasCaptureMouse:=(csCaptureMouse in ControlStyle);
    ControlStyle:=ControlStyle - [csCaptureMouse];
    inherited;
    if wasCaptureMouse then
      ControlStyle:=ControlStyle + [csCaptureMouse];
    // #909
    // if we show a modal form in the HandleMouseDblClick(), the mouse capture wont be released
      if csCaptureMouse in ControlStyle then MouseCapture := False;
  finally
    DoStateChange([], [tsLeftDblClick]);
  end;
end;

@joachimmarder joachimmarder added the Repro Steps Missing A smple project is needed to reprodcue and analyze the issue. See our guidelines for opening issues! label Sep 6, 2023
@joachimmarder
Copy link
Contributor

Please respect our guidelines on the project homepage for submitting bugs. Please include your version of Virtual TreeView and Delphi, and attach a sample compiling project as ZIP to your report, or instructions how to modify one of the included sample projects to reproduce the problem.

Actually the fix looks a bit hacky to me and I would like to further understand the problem and the proposed solution.

@joachimmarder joachimmarder added the Open for Discussion There are several possibilites to address the issue and anyone is invited for comments. label Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Open for Discussion There are several possibilites to address the issue and anyone is invited for comments. Repro Steps Missing A smple project is needed to reprodcue and analyze the issue. See our guidelines for opening issues!
Projects
None yet
Development

No branches or pull requests

2 participants