disabled buttons still receive events, they just process them, later?

Mark Waddingham mark at livecode.com
Wed Feb 21 17:16:19 EST 2024


It’s because of the wait - ‘blocking’ waits (those which aren’t ‘with messages’) queue any (low level) events so they are handled at the next wait (in this case the global one the engine does implicitly when there are no handlers executing).

Flushing events after the wait as Jacque suggests will ensure they aren’t there to handle.

Warmest Regards.

Mark.

Sent from my iPhone

> On 21 Feb 2024, at 21:59, Mike Kerner via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> i did.
> i have both a button, and a power button.
> script:
> 
> *local* count
> 
> *on* mouseUp
> 
> *if* the disabled of me *then* *put* cr & "disabled" after msg
> 
> *add* 1 to count
> 
> *set* the enabled of me to false
> 
> *put* count
> 
> *wait* 2 second
> 
> *set* the enabled of me to true
> 
> *end* mouseUp
> 
>> On Wed, Feb 21, 2024 at 4:47 PM Craig Newman via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>> 
>> Mike.
>> 
>> In a new stack I placed a button with this:
>> 
>> on mouseUp
>>  beep 2
>> end mouseUp
>> 
>> If I click on the button I hear two clicks. I disabled the button and
>> clicked on it. I enabled the button. No clicks. I did this all by hand. Did
>> you?
>> 
>> Craig
>> 
>>> On Feb 21, 2024, at 4:07 PM, Mike Kerner via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>> 
>>> alright, i'm a little surprised to notice this:
>>> i have a button. i disabled the button.
>>> then i clicked on the button
>>> then i re-enabled the button
>>> the click, from the period while the button was disabled, is received and
>>> processed by the button.
>>> that seems problematic, to me. how would one cause clicks to be
>> discarded,
>>> permanently? hide the button? overlay it with a transparent control that
>>> will absorb and ignore the clicks?
>>> 
>>> --
>>> On the first day, God created the heavens and the Earth
>>> On the second day, God created the oceans.
>>> On the third day, God put the animals on hold for a few hours,
>>>  and did a little diving.
>>> And God said, "This is good."
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> 
> -- 
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
>   and did a little diving.
> And God said, "This is good."
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list