Have a button to close a dropdown menu

7 ビュー (過去 30 日間)
Nev Pires
Nev Pires 2020 年 8 月 28 日
回答済み: Image Analyst 2020 年 8 月 28 日
I have created a very simple dropdown menu where the user will be prompted to choose from the dropdown list. I would like to be able to have a button that will close dropdown menu when the selection has been made.
cityDropdown = uifigure;
citydd = uidropdown(cityDropdown, 'Items', {'Osaka', 'Mumbai', 'Oslo', 'Mombassa'});
city = citydd.Value;
I would like to add a button that says something like "Press here after city selection has been made" that will return the selection to the workspace (line 3), and will close the figure as it's not needed (rather than having to prompt the user to close the figure using the X on the top right corner).
Also, is there a way to add a title?

回答 (1 件)

Image Analyst
Image Analyst 2020 年 8 月 28 日
You need to add a callback function with the 'ValueChangedFcn' property. See the help for the example.

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by