Disable a button for a few miliseconds

Hi!
I’m making a project where you can change the order of some elements by clicking two arrow buttons, up and down.
This elements are horizontal arrangements which have inside other buttons and labels, all generated by Dynamic components.
While changing the order, a few calculations had to be done so if you click several times so quickly the up or down button, these calculations are not complete so the procedure fails.
I’ve tried to disable the up and down buttons with timers, but it doesn’t work. If buttons are touched quickly only appears the message “Time already running” and this is not what I want.
Please some help here.
Thanks.

disable the buttons, then start a clock, inside the clock timer event stop the clock, do the calculation and set the buttons to enabled again

Taifun

5 Likes

Or use the notifier progress dialog that will prevent user access to the app until the dialog is closed

2 Likes

create a variable to keep the counts of button click, if after some particular amount of clicks, call a timer that disables the button(s) for a while…

1 Like

Hi!
I must be doing something wrong because it doesn’t work. Here are the blocks:
2020-11-16 10_23_12-Kodular Creator
The blocks for “subir” (up) button are the same.
The movement of the arrangements is done after the time interval and if buttons are pressed quickly, the “timer already running” is showed or the calculations are not properly done.

the blocks look fine
how do the procedures BloquearSubirYBajar and DesbloquearSubirYBajar look like?
the timer interval could be very short, for example 10 milliseconds…
what exactly means “it doesn’t work”? what happens and what do you want to happen instead?

Taifun

2 Likes

These procedures are quite a bit complicated because the internal logic of the project but they work fine if you click the up and down buttons with a relative long interval of time.
For “it doesn’t work” I mean that if I click the any of the up or down buttons quickly, even with this timers set, appears the “timer already running” advise or the procedure fails because the calculations aren’t complete and the horizontal arrangements (with several elements inside) are not properly moved.

these procedures should only enable or disable the buttons
al other logic you should start in the clock.timer event

Taifun

Something like this. User clicks the button which disables it. Then run the procedure from the button click event, and start the clock at the end of the procedure. The clock re enables the button after stopping the clock.

image

1 Like

I’ll try this way and see.
Thanks so much!