Possibility of dropdown from a toolbar button in app designer?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Ayush Modi
el 18 de Jul. de 2024
Editada: Ayush Modi
el 18 de Jul. de 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 comentarios
Ver también
Categorías
Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!