Possibility of dropdown from a toolbar button in app designer?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!