Octavian Rasnita wrote:
Hi,
My program uses an internal web server which is ran in a separate thread
and
when a certain address is accessed, I want it to display a certain
Wx::Dialog.
I've seen that I can display with no problems a Wx::MessageBox, but I can't
display well a Wx::Dialog because it freezes the application. The dialog
doesn't display anything on the screen, or at least with my screen reader I
can read just the title of the dialog. If I close the dialog with
Alt+F4, it
appears a window telling me that the application is not responding, and it
asks me if I want to end it now.
In general, you can't use any GUI class form a separate thread (this
is also true for the C++ API).
Do you know why Wx::MessageBox works but not Wx::Dialog and if it is
possible to do what I want, maybe using another ways?
On Windows Wx::MessageBox is a thin wrapper around a native Win32 API
so it works; it might not work from a separate thread on GTK or Mac OS.
The advice for displaying windows from a separate thread is to
send an event to the main thread and have the window displayed from
there. See Wx::Perl::Thread::Listener on CPAN for a short example on
how to do that (Wx::App::MasterMind is an example of a threaded GUI app,
but I think it will be unusable with a screen reader).
PS. Can you tell me if WxPerl works with Perl 5.10?
As far as I know, yes.
HTH
Mattia