How to make uicontrol edit box only show the text when needed?

6 ビュー (過去 30 日間)
xiaojuezi
xiaojuezi 2021 年 11 月 18 日
回答済み: Jan 2021 年 11 月 18 日
Hi, I have a uicontrol edit box. When nothing is entered, by default, the edit box looks empty. Now I would like to add an additional checkbox, if users want to see the entered text, the edit box will display what they've written, but if they disable it, the editbox will hide it (but still keeps what they've written before). In short, the editbox will always exist, but users can switch between text displaying or not. Is there an easy way to do so?
Thank you very much!

回答 (1 件)

Jan
Jan 2021 年 11 月 18 日
You can simply delete the 'String' property of the text box, when the checkbox is disabled and store the contents e.g. in the UserData. Then the callback of the checkbox copies the UserData to the String property.
Maybe you want to disable the edit field also using the CheckBox, such that the user cannot insert new characters.

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by