[wxpython-users] Catching user leaving the window
Werner F. Bruhin
werner.bruhin at free.fr
Mon Sep 8 13:29:09 PDT 2008
Robin,
Robin Dunn wrote:
...
> Personally I think your users will hate you if you do something like
> this. Given the multi-process nature of modern operating systems and
> GUI environments it is *very* common to be doing more than one thing
> at a time, in my case it is usually a dozen or so things at one time.
> For example, suppose the phone rings while your user is entering data,
> and they have to switch to their calendar application to look
> something up, and then they switch back to your application only to
> find that their data entry work was thrown away and rolled back to the
> prior state. It would only take one such occurrence for me to
> uninstall the app and never look at it again.
You are absolutely right. Thanks for hitting me with this!
>
> Instead, let them do other things and only worry about rolling back,
> or asking the user to save, or whatever, if they change the state in
> your application such that it would cause the currently "dirty" data
> entry forms to be closed, cleared, or reloaded with new data.
So, instead of depending on an event here I should set a flag/variable
which I then need to check when loading new data (or doing other tasks
which will have a problem with the dirty data). I am already using
pubsub to inform listeners that data needs saving, so I guess I just
need to extend the listener for that to set this flag and do another
pubsub when data is saved.
Or is there some other technique/pattern I should look out/read up on?
Werner
More information about the wxpython-users
mailing list