[Gambas-user] Setting a checkbox value

Fabien Bodard gambas.fr at ...626...
Sat Nov 21 23:01:36 CET 2009


but in this case it will work

Object.lock(checkbox)
Checkbox.value=true
Object.Unlock(checkbox)

so then the events are fired ... it is just blocked during the variable setting

2009/11/21 Doriano Blengino <doriano.blengino at ...1909...>:
> 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."
>
>
> ------------------------------------------------------------------------------
> 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 at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list