how to ignore multiple clicks on buttun in matlab app designer

6 ビュー (過去 30 日間)
Kfir Weissman
Kfir Weissman 2021 年 6 月 16 日
コメント済み: Kfir Weissman 2021 年 6 月 16 日
hi, when i execute my app designer script by 1 click its doing well.
but when i spam the button or just double clicking it, it's execute the callback multiple times or maybe sometimes causing a error for running more that once the callback code.
my question is if there is something to ignore this multiple click on the button and execute the callback function just once.
thanks.
  2 件のコメント
pcm314
pcm314 2021 年 6 月 16 日
Is the user supposed to click that button only once during the entire run time of the app?
If so you can add a line of code to disable the button just after it is pushed, before the rest of the code of the callback:
function PushButtonPushed(app, event)
app.PushButton.enable = 'off'
% Other stuff
end
Then, whenever you want to bring it back to life just set the flag to on.
Kfir Weissman
Kfir Weissman 2021 年 6 月 16 日
編集済み: Kfir Weissman 2021 年 6 月 16 日
hi thanks for answering.
i already try your suggestion, the problem is when im like spamming the button, the button not disable himself that fast and he still have a lot of calls to the callback function
is there any wat to cancel the calls for the callback after one click?

サインインしてコメントする。

採用された回答

Matt J
Matt J 2021 年 6 月 16 日
編集済み: Matt J 2021 年 6 月 16 日
You can set the Interruptable property of the button to 'off' and the BusyAction property to 'cancel'.
  1 件のコメント
Kfir Weissman
Kfir Weissman 2021 年 6 月 16 日
Thank you very muchhh!!!!!
working well now:)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by