Sly, Rob, Sean - thanks for the quick responses.  

The OnClick handler would work fine -  but AFAIK the right  mouse button 
can't generate the OnClick event, so I can't use the "left button to 
select and edit, right-button to open the dialog" approach. 

I had tried using the OnMouseUp event handler before, but then a 
right-click in the TEdit brings up the standard context menu for the 
*TEdit* control (Undo | Cut | Copy | Paste etc) before the OpenDialog 
appears, instead of the context menu for the dialog after it appears.

However, thanks to your prompts I revisited the idea of using the 
OnMouseUp event on the grounds that maybe it's easier to control the 
context menu behaviour of the TEdit than the TOpenDialog .  Here's a 
solution: put an empty  TPopupMenu on the form and associate it with the 
TEdit. This overrides the standard (Undo | Cut ... ) context menu, but 
(presumably because it is empty) doesn't actually pop anything up when I 
right click in the TEdit. Not very elegant and a terrible waste of 
resources  :-)  to have an otherwise unused component on the form - but 
it works.
 
(BTW, if I was just populating a TEdit of course I could use a "Browse" 
button and open the dialog in the button click handler. However, it's 
much nicer to use this left button/right button approach  so users can 
optionally populate cells in a big TStringGrid ).

Thanks again.

Rob



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

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

Reply via email to