Possibility of dropdown from a toolbar button in app designer?

2 ビュー (過去 30 日間)
Ian
Ian 2024 年 7 月 17 日
編集済み: Ayush Modi 2024 年 7 月 18 日
I'd like to create a dropdown menu from the upper toolbar of an app that im designing. This dropdown would be to select the color pallete of a figure in the app. Is it possible to have a dropdown menu appear from a toolbar button?

回答 (1 件)

Ayush Modi
Ayush Modi 2024 年 7 月 18 日
編集済み: Ayush Modi 2024 年 7 月 18 日
Hi Ian,
I am assuming by upper toolbar, you mean the Push Tool button in the toolbar of the App Designer. Yes, you can have a dropdown menu appear from a toolbar button. Here, are the required steps to achieve the same:
1- Create the Toolbar Button
2- Add a DropDown Component.
3- Create a Callback for the Toolbar Button - To read more about the callbacks in the app-designer, refer to the following MathWorks documentation - https://www.mathworks.com/help/matlab/creating_guis/write-callbacks-for-gui-in-app-designer.html
4- Hide the DropDown Initially - You can change the visibility of the DropDown using the 'Visible' property.
function startupFcn(app)
% Hide the DropDown component initially
app.DropDown.Visible = 'off';
end
5- Show the DropDown When Toolbar Button is Pressed.
function ToolbarButtonPushed(app, event)
% Make the DropDown component visible
app.DropDown.Visible = 'on';
end
% Code that runs after component creation
6- Create a Callback for the DropDown - Write the code to select the color pallete in it.

カテゴリ

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

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by