Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenImageEnDialog question 1

Status
Not open for further replies.

pierrotsc

Programmer
Nov 25, 2007
358
US
I use OpenImageEndialog from Imageen to browse for a image file. this questioncould also be adapted for any open opendialog file.
How can i find out if the user has press the ok key to load an image or cancel?
Here's the code:
OpenImageEnDialog.InitialDir := ParamStr(0);
if OpenImageEnDialog.Execute then
ImageEnView3.IO.LoadFromFile(OpenImageEnDialog.filename);

Right now, to check if an image has really been loaded, I wrote:
if OpenImageEnDialog.filename<>'' then showmessage('Canceled');
Is there a better way?

Thanks.
 
With most of these Delphi dialogs, Execute returns false when a file hasn't been selected. So you should be able to do something like:

Code:
If OpenDialog1.Execute then
  // do some stuff against the file
else
  ShowMessage('cancelled');

without any problems...

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
Thanks. I leran something tonight. Works great..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top