[wxpython-users] Catching user leaving the window
Tim van der Leeuw
tnleeuw at gmail.com
Mon Sep 8 07:04:36 PDT 2008
On Mon, Sep 8, 2008 at 3:30 PM, Mike Driscoll <mike at pythonlibrary.org>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 chan=
ging
>> to another page.
>>
>> This works fine as long as user goes to another notebook page, but if th=
ey
>> 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.
>
Doesn't that track mouse-movement? Wouldn't it be a bit extreme to rollback
your database-transaction and already-entered data just b/c the user moves
the mouse? ;-)
You could perhaps try window activate/deactivate events, I think that these
apply only to the whole wx.Frame; not to individual widgets.
Cheers,
--Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200809=
08/3d81378a/attachment-0001.htm
More information about the wxpython-users
mailing list