[wxpython-users] Catching user leaving the window

Mike Driscoll mike at pythonlibrary.org
Mon Sep 8 06:30:59 PDT 2008


Hi Werner,

> I have a FlatNotebook and use the event 
> "EVT_FLATNOTEBOOK_PAGE_CHANGING" to catch page changing to ensure that 
> user either saves data before changing to another page.
>
> This works fine as long as user goes to another notebook page, but if 
> they go "outside" the flatnotebook I can't find an event which lets me 
> catch this.
>
> Tried "EVT_CHILD_FOCUS" but that fires very often and I haven't 
> figured out a nice way to just rollback the database connection in the 
> right situation.
>
> I also tried "EVT_KILL_FOCUS" but does not seem to fire for the 
> flatnotebook - is this a known issue?
>
> Do I have any other options?
>
> Werner

Did you try EVT_LEAVE_WINDOW ? I would think that would work no matter 
which widget you're using, unless the OS doesn't support it.

-------------------
Mike Driscoll

Blog:   http://blog.pythonlibrary.org
Python Extension Building Network:     http://www.pythonlibrary.org




More information about the wxpython-users mailing list