[wxpython-users] Catching user leaving the window

Werner F. Bruhin werner.bruhin at free.fr
Mon Sep 8 07:24:26 PDT 2008


Mike,

Mike Driscoll wrote:
> 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.
I tried this but no luck (Windows, Python 2.5.2, wxPython 2.8.8.1 Unicode)

Will have to do a small sample app to make sure that it is not something 
I do in my app.

Werner


More information about the wxpython-users mailing list