필터 지우기
필터 지우기

Menu bar App Designer

조회 수: 18 (최근 30일)
Marco Picillo
Marco Picillo 2021년 3월 17일
댓글: Marco Picillo 2021년 3월 18일
Hi, i created a panel with a plot and other stuff, and a menu. I want to display the panel with its content only when i click to a specific tab of the menu. How can i do that? thank you

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 3월 17일
Us the TabGroupSelectionChanged callback function to set the visibility property of the panel to on/off. Here's what the code might look like if I only wanted to display the panel with Tab2 is visible.
% Selection change function: TabGroup
function TabGroupSelectionChanged(app, event)
selectedTab = app.TabGroup.SelectedTab;
switch selectedTab.Title
case "Tab2"
app.Panel.Visible = 'on';
otherwise
app.Panel.Visible = 'off';
end
end
I would have to set the visibility of the panel to the desired visibilty at launch using the inspector. There is a check box for visible in the Panel Interactivity section of the inspector.
  댓글 수: 3
Cris LaPierre
Cris LaPierre 2021년 3월 17일
Ah, sorry. The OP mentioned clicking on a tab. You can add a MenuSelectedFcn callback. For example, to have it appear when selecting Menu2
% Menu selected function: Menu2
function Menu2Selected(app, event)
app.Panel.Visible = 'on';
end
You would have to add the code to turn off visibility to whatever function you use to close the menu.
Marco Picillo
Marco Picillo 2021년 3월 18일
thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by