[wxPython] modal dialog becomes modeless

Magnus Lycka wrote:
Maybe you could close the dialog as you open the
tablepreview, and then do a ShowModal again as the
tablepreview is closed?

Good idea. But how do I know that tablepreview has been
closed? I don't know very much about events.

Marcus
mailto:stojek@part-gmbh.de

Well, if your main frame gets focus again, it will receive an
event for that. You need this in your frame.__init__:

         EVT_ACTIVATE(self, self.OnActivate)

There is also the event EVT_SET_FOCUS, but it might be some other
window inside your frame, and not the frame itself that gets focus,
so that is a bit tricky to use for this.

Let's imagine that you have a "self.reOpenDialog = 0" in frame.__init__,
and when you open the tablepreview you set it to 1 as you close your
dialog for the time being. In OnActivate you have a "if self.reOpenDialog"
that will run the method you use to open the dialog.

But I'm a bit curious about the lost modality. When you do
dialog.ShowModal() your code will normally wait here until
you close your modal dialog. Then it will run the rest of
the code where you typically check what button you pressed etc.

What happens when you "loose modality"?

Let's say you put a print statement directly after ShowModal,
when is that run?

When you open the tablepreview?
When you close the tablepreview?
When you get back to your dialog and close it?
Never?

I don't quite understand what is happening with
the event loop here...

···

At 19:44 2002-04-11 +0100, you wrote:

>Magnus Lycka wrote:
>Maybe you could close the dialog as you open the
>tablepreview, and then do a ShowModal again as the
>tablepreview is closed?

Good idea. But how do I know that tablepreview has been
closed? I don't know very much about events.

--
Magnus Lyckå, Thinkware AB
Älvans väg 99, SE-907 50 UMEÅ
tel: 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se