Possibility of dropdown from a toolbar button in app designer?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
0 Kommentare
Antworten (1)
Ayush Modi
am 18 Jul. 2024
Bearbeitet: Ayush Modi
am 18 Jul. 2024
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!