[Gambas-user] please don't take away the cancelling events thing :)
gambas at ...2...
Wed Oct 1 21:44:16 CEST 2003
Le Mercredi 1 Octobre 2003 21:30, Rob a écrit :
> On Saturday 20 September 2003 03:24, Benoit Minisini wrote:
> > I forgot to write in the ChangeLog that to cancel a keyboard
> > event, you must type Key.Cancel = TRUE and not return TRUE
> > anymore.
> > I think I will drop the feature of returning something from an
> > event handler. At the moment, only keyboard events were
> > concerned.
> I'm currently editing a project written by someone at a client
> site, and they do something like the following:
> PUBLIC reallyclose AS Integer
> PUBLIC FUNCTION Form_Close() as Boolean
> if reallyclose < 1 then return true
> PUBLIC FUNCTION QuitButton_Click()
> try myprocess.kill
> reallyclose = 1
> In this way, they can disable QuitButton while a CD burn process
> completes, and the user is unable to accidentally close the app
> even with the normal close widget. (Obviously they could still
> kill the process from a shell or something but their operators
> don't know how to do that, generally.) It works well as
> Will you at least have a LAST.Cancel type of replacement if you
> decide to do away with the FUNCTION...as Boolean method of
> cancelling events? (Of course, that would be inconsistent with
> the Key.Cancel and Mouse.Cancel methods you're describing...)
> Maybe a new keyword CANCEL is what you're looking for... can't
> get much clearer than that, can you?
You are right. So there are two solutions :
1) Make a Form.Cancel property to cancel Form_Close events, like Mouse.Cancel
2) Make a new keyword (a new syntactic sugar) named CANCEL EVENT.
Hmmmm.... I like the second solution, as it is clearer to read in the code -
Canceling an event is an important thing.
I will see what I can do, surely when I will be back from Canada !
mailto:gambas at ...1...
More information about the User