Clear Filters
Clear Filters

GUI

3 views (last 30 days)
Pan
Pan on 6 Mar 2012
Answered: Abhay Aradhya on 9 Jun 2017
How to creat a hierarchical window ,detail that pushing one button can go to another window that have some buttons can be chose, and can go back original window.

Answers (1)

Abhay Aradhya
Abhay Aradhya on 9 Jun 2017
You could do this using the callbacks of the button property
ax = figure('Name','First GUI');
selectButton1 = uicontrol('Parent',ax,'Style','pushbutton','String',"Select",...
'Units','normalized',...
'Position',[.325 .25 .05 .5],...
'Callback', @(h,e)firstCallback(ax));
function firstCallback(ax)
ay = figure('Name','Second GUI');
selectButton2 = uicontrol('Parent',ay,'Style','pushbutton','String',"Select",...
'Units','normalized',...
'Position',[.325 .25 .05 .5],...
'Callback', @(h,e)secondCallback(ax));
end
function secondCallback(ax)
close(ax);
end
Here the first GUI has a button(selectButton1), upon clicking opens 2nd GUI with another button(selectButton2). On clicking of selectButton2 the first GUI closes.
You can go on nesting them like the example above.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!