wxFrame.OnActivated

Hi.
In my texteditor i'm using this event for the main frame:
EVT_ACTIVATE(self, self.OnActivate)

this to check if files has been modified outside my application.
The problem is that I want to show a Dialog message asking if user want to reload the file (only if file has been modified).
This work fine, but the problem is that once i click on the OK button of the dialog

wxMessageDialog(self, "%s has been modified, do you want to reload it?" % self.GetTextCtrl(k).filename, caption = "Attention", style
= wxOK | wxCANCEL,pos = wxDefaultPosition).ShowModal()

the OnActivated method is call again, because the window receive again the focus. Inthis way there is an infinite loop.
But I would like that the onActivated function is called only when switching fro another application to my app.

Alessandro Crugnola [aka] sephiroth
Flash | PHP Developer
http://www.sephiroth.it

Team Macromedia Volunteer for Flash
http://www.macromedia.com/go/team

Alessandro Crugnola *sephiroth* wrote:

Hi.
In my texteditor i'm using this event for the main frame:
EVT_ACTIVATE(self, self.OnActivate)

this to check if files has been modified outside my application.
The problem is that I want to show a Dialog message asking if user want to reload the file (only if file has been modified).
This work fine, but the problem is that once i click on the OK button of the dialog

wxMessageDialog(self, "%s has been modified, do you want to reload it?" % self.GetTextCtrl(k).filename, caption = "Attention", style
= wxOK | wxCANCEL,pos = wxDefaultPosition).ShowModal()

the OnActivated method is call again, because the window receive again the focus. Inthis way there is an infinite loop.
But I would like that the onActivated function is called only when switching fro another application to my app.

You will need to set a flag (say self.ignoreActivateEvent) whenever you do something that may cause an activation event like showing dialogs, and then check the flag in your event handler.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!