[Gambas-user] Setting a checkbox value

Doriano Blengino doriano.blengino at ...1909...
Sat Nov 21 17:29:12 CET 2009


Fabien Bodard ha scritto:
> Le 21 novembre 2009 14:10, Benoît Minisini
> <gambas at ...1...> a écrit :
>   
>>> bbb888 ha scritto:
>>>       
>>>> Benoit,
>>>>
>>>> Why oh why should setting checkbox value in code generate a click event?
>>>>
>>>> bruce
>>>>         
>>> I join.
>>> I think that events should be fired by user, never by code.
>>>
>>> Regards,
>>>
>>>       
>> Why should we make a difference between the user and the code? Most of the
>> time it is useless, so when you need that, just block events explicitely.
>>     
>
>
> Object.Lock
> Object.UnLock
>   
These methods locks even the useful events too. I wrote a file manager 
having this issue. In a treeview, if you click on an item, a fileview 
gets filled with filenames. If you doubleclick on a item in a treeview, 
the treeview branch expands. By using Object.Lock() (I don't remember 
why I used it, but the original DirTreeView uses it as well), a double 
click is lost by the time the first click is fired to fill the fileview. 
I should use a boolean variable instead of lock()/unlock(). But this 
reminds to me the microsoft way: at first they do the bad thing, and 
then they do another thing to circumvent the first, instead of 
correcting it. Here the bad thing is to fire event from code, and then 
prohibit them from code again.

Regards,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."





More information about the User mailing list