Matlab guide GUI toogle/push button?

3 ビュー (過去 30 日間)
Hector De La Torre
Hector De La Torre 2018 年 7 月 30 日
編集済み: Adam Danz 2018 年 7 月 31 日
I have been working on a matlab GUI for a while now and have finally gotten it do what I want now I am just working on making a bit cleaner and user friendly. I have 5 panels and have stacked them all on top of each other and have added 5 push buttons on top of the panel. Is there a way to be able to bring a panel to the front by pressing on the push button? (This the easiest way I can think of to make tabs that will jump from panel to panel)
function togglebutton2_Callback(hObject, eventdata, handles)
This is my call back for the push button. Is there anything I can add to bring a panel to the front by simply clicking on the push buttton? Thanks

採用された回答

Adam Danz
Adam Danz 2018 年 7 月 30 日
編集済み: Adam Danz 2018 年 7 月 30 日
Two options off the top of my head. Both of these options would be executed in your pushbutton callback function where you also need access to the panel handles.
Option 1: 'Visible' property
Set all panels to 'off' except for the one "on top" which will be set to 'on'.
set([p1,p2,p3,p4,p5], 'Visible', 'off')
p3.Visible = 'on';
Option 2: uistack()
Put the panel you'd like to see on top of the rest.
uistack(p3, 'top')
The better option is the first one.
  5 件のコメント
Hector De La Torre
Hector De La Torre 2018 年 7 月 31 日
Never mind once I stack the panels on top of each other then I should only be able to see the one on top. Thanks!
Adam Danz
Adam Danz 2018 年 7 月 31 日
編集済み: Adam Danz 2018 年 7 月 31 日
You need to initialize the panels with the 'Visible' 'off' property set. If you're using GUIDE, you can open the GUI in GUIDE and set the properties there. An alternative is to call the togglePanels() function from the ..._OpeningFcn().

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by