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.
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!