Do it on the mouse up or mouse click. 

Regards

Sean
-----------------------------
Sean Cross
Systems Development

CRM
PO Box 230
Napier
Phone:   06 835 5868
Mobile:  021 270 3466
Email:   [EMAIL PROTECTED]



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rob Cameron
Sent: Thursday, 10 November 2005 5:08 a.m.
To: [email protected]
Subject: unexpected popup menu

I want users to be able to select and type in a text control, or alternatively 
to right-click in the control and select a file using a TOpenDialog.  I've put 
instructions to execute the TOpenDialog in the OnMouseDown event handler, like 
this:

procedure TForm1.Edit1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Button = mbRight then
   if OpenDialog1.Execute then
     Edit1.Text := OpenDialog1.FileName; end;

This works fine ... unless the form is positioned so that the cursor which 
clicks on the control happens to be in the same part of he screen which will be 
occupied by the OpenDialog when it is created.  In that case, the OpenDialog 
pops up a menu as if I had just right-clicked on the OpenDialog itself. 

To see the effect, create a new application, put a TEDit and a TOpenDialog on 
the form, and the code above in the event handler. Move the form around until 
the TEdit is underneath the OpenDialog when it shows up.

Any ideas how I can suppress the popping-up of the popup?

Many thanks,

Rob

--
Rob Cameron
Lattice Networks Limited
tel: 01923 263 143
mob: 078 3434 8153
email: [EMAIL PROTECTED]
web: www.lattice-net.co.uk
-------------------------------
Reclaim Your Inbox!
http://www.mozilla.org/products/thunderbird/



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.362 / Virus Database: 267.12.8/162 - Release Date: 05/11/2005

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi


_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to