AW: Overriding the default "file does not exist" error dialog.
Joerg Toellner
toellner at oss-gmbh.de
Thu Aug 16 23:27:19 PDT 2007
Hi Patrick,
I can't be of any help with the question why your solution won't work. But
maybe you can use this workaround.
Use:
::wxFileExists
bool wxFileExists(const wxString& filename)
Returns true if the file exists and is a plain file
to check if the file is present and load it only if its there, and after
loading use:
wxBitmap::IsOk
bool IsOk() const
Returns true if bitmap data is present
to check if loading succeded.
In case of error, use a normal wxMessageBox to display whatever you want to
show to your users.
HTH
Greeting
Joerg
-----Ursprüngliche Nachricht-----
Von: -Patrick [mailto:CaptainMorganRawks at gmail.com]
Gesendet: Freitag, 17. August 2007 06:18
An: wx-users at lists.wxwidgets.org
Betreff: Overriding the default "file does not exist" error dialog.
I have a file that I am testing for when it is not found. As a result of it
not being found I am receiving the dialog:
"Can't load image from file 'images/mypic.gif': file does not exist."
When I or a user hit OK to close the dialog the dialog flickers and never
closes. I end up having to force quit the application. I thought of writing:
if (!bitmap.LoadFile(wxT("images/mypic.gif"), wxBITMAP_TYPE_GIF)) {
wxMessageDialog(this, wxT("Problem loading image, please check
resources.")); }
in the OnPaint() but it appears this if statement is ignored.
Am I making any sense? Can I override the dialog that never closes with the
above? Or is there something else I am missing or another alternative?
Thanks,
-Patrick
---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
More information about the wx-users
mailing list