app will dispear when using uisetcolor as colorpicking function

Hi everyone,
I am using app desinger to creat a simple app. the function that I am working on is assign RGB value to a table by uisetcolor function. The code is listed as below:
function ColorPickerButtonPushed(app, event)
app.UITable2.Data = uisetcolor;
figure(app.UIFigure)
end
The app would go to backgroud if I try to run this button within matlab. If I export the code into a seperate app, it could disappear if I click this button. Thank you very much for any suggustion.

回答 (1 件)

Adam Danz
Adam Danz 2022 年 7 月 12 日
編集済み: Adam Danz 2022 年 7 月 13 日

0 投票

uisetcolor is a modal dialog meaning it blocks interaction with other windows until the user closes it. After the dialog is closed, focus should return back to your app. There is no way to make uisetcolor non-modal.
I didn't understand the second proposal in your question regarding exporting the code (which code?) and something disappearing.
update: Note that in R2021a there is a known bug that causes the crash with compiled apps when using uisetcolor. This bug was fixed. See this answer for more info.

6 件のコメント

Jian Yu
Jian Yu 2022 年 7 月 13 日
Hi Adam,
Thank you so much for your reply. The problem with uisetcolor is it will go to backgroud if I use this fuction. I could use figure(app.UIFigure) to get focus back in matlab. However, if I use matlab compiler to export this app as a standalone desktop app, the app will just disapear after using uisetcolor function. It seems it's a bug of matlab.
Adam Danz
Adam Danz 2022 年 7 月 13 日
I wasn't aware that your app was compiled.
I see you are using MATLAB R2021a. This is a known bug in 21a that was fixed with update #2 (or in any later releases). See more info. Update your 21a release or download a newer release.
Jian Yu
Jian Yu 2022 年 7 月 13 日
Thank you Adam for the detailed answer. I have also seen the same anwser. I upgraded matlab to 2022 but still not working. I guess the bug is still not solved.
Adam Danz
Adam Danz 2022 年 7 月 13 日
@Jian Yu, please contact tech support and please mention the bug report below.
Varun Pai
Varun Pai 2022 年 11 月 24 日
I have a MATLAB 2021b Linux CentOS7 application. 'uisetcolor' behaves non-modal. Is it a known bug ?
Adam Danz
Adam Danz 2022 年 11 月 28 日
@Varun Pai, thanks for the comment. Yes, that sounds like a bug.
Please contact tech support and include the release and OS indicated in your message above.

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

カテゴリ

ヘルプ センター および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品

リリース

R2021a

質問済み:

2022 年 7 月 12 日

コメント済み:

2022 年 11 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by