Benoît Minisini ha scritto: >> Benoît Minisini a écrit : >> >>>> Fabien Bodard a écrit : >>>> >>>>> it seem that the click event is send after the .value setting... but >>>>> the MouseUp before. >>>>> >>>>> why did you not use the click event ? >>>>> >>>> I don't use it because it is raised after the .Value has changed and I >>>> need to be able to forbid any change in some conditions. >>>> >>> - You can't assume any relationship between Mouse events and the Click >>> event raised when the value has changed. >>> >> That's NOW obvious, but not @ first glance and without a test to see >> exactly which order is given to events. >> >> > > And because you can raise the Click event by code, or by using only the > keyboard. > > >>> - If the checkbox should not be changed, then it must be disabled before >>> the user tries to change it. >>> >> That doesn't prevent MouseDown/Up etc events to be raised >> > > Why should it? > This affirmation seems strange to me. A disabled control should not raise events... why should it? What is the purpose of disabling a control? I think it is to make it read-only - so the user can not interact with it. Anyway, if I remember well, there is another way to prevent control to raise events: lock(), right?
And here I remember another thing: most toolkit raise click, changed, and so on when something in a control is changed by code and not by user. I think this is stupid. If the program changes something in the control, the very same code can take appropriate actions, so there is no need to use events for that. But normally events are raised in such situations, and one must use added code to ignore events, and so on. What is happening to Jean-Yves is one example; another one it's from me; I am using GTK to write an IDE. I take a gtk_text_view and load into it a file to be edited. The flag "changed" becomes true, and an event is fired. But the file is not changed - it has just been readed from disk! And there are many more. In the Gambas sources of DirTreeView there are tricks like "bIgnore" and lock() and so on. This way code gets more obfuscated instead of being more clear and straight. Regards, Doriano ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user