Jump to content
Sign in to follow this  
Mike Torrettinni

Issue with TVirtualStringTree OnNodeDblClick

Recommended Posts

Not sure how to describe the issue, so here is the strange behavior: When I double click the VirtualStringTree1Node to ShowMessage('Node dbl clicked'), I need to click twice (the Close button - X ) to close the form, after the message window is closed.

 

Simple example of new form with VirtualStringTree1 control:

 

procedure TForm8.FormCreate(Sender: TObject);
begin
  VirtualStringTree1.RootNodeCount := 1;
end;

procedure TForm8.VirtualStringTree1NodeDblClick(Sender: TBaseVirtualTree; const HitInfo: THitInfo);
begin
  ShowMessage('NODE dbl clicked');
end;

I tried Application.ProcessMessages after ShowMessage, no change, still need 2 clicks to close the form.

 

Any ideas what am I doing wrong?

 

VTVersion = 7.2.1

 

Edited by Mike Torrettinni

Share this post


Link to post

I ended up using PostMessage:

 

TForm1
...
const
  WM_OpenRealTimeMonitoringForm = WM_APP + 1; 
private
  procedure OpenRealTimeMonitoringForm(var Message: TMessage); message WM_OpenRealTimeMonitoringForm;
  
 
procedure TForm1.VSTOnNodeDblClick(Sender: TBaseVirtualTree; const HitInfo: THitInfo);
begin
  // Use PostMessage to correclty handle DblClick, to avoid mouse-event be eaten by modal window...
  PostMessage(Self.Handle, WM_OpenRealTimeMonitoringForm, 0, 0);
end; 

procedure TForm1.OpenRealTimeMonitoringForm(var Message: TMessage);
begin
  ...
  Form.Show;
end;

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×