Why the panel was not Visible??
Show older comments
I write this code inside callback function in guide pushbutton, to create programatical panel, but it was not visible. The code excute without any error.
% --- Executes on button press in bright.
function bright_Callback(hObject, eventdata, handles)
% hObject handle to bright (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%create new Panel for Brightness, Contrast, Resolution.
global stat
stat = 0;
figure1 = findobj('Tag','figure1');
brightPanel = uipanel('Parent',figure1,'Title','Sitting',...
'Position',[83, 118, 250, 400],...
'Tag','BrightPanel');
set(brightPanel,'Visible','off');
brightText = uicontrol(brightPanel,'Style','text',...
'String','Brightness',...
'Position',[50, 327, 82, 25]);
brightValueEdit = uicontrol(brightPanel,'Style','edit',...
'String','',...
'Tag','BVEdit',...
'Position',[143, 327, 40, 25]);
brightValueSlider = uicontrol(brightPanel,'Style','slider',...
'String','',...
'Tag','BVSlider',...
'Max',100,'Min',-100,'Value',0,...
'SliderStep',[1 5],...
'Position',[55, 283, 140, 18]);
set(brightPanel,'Visible','on');
set(handles.back2mainMenu,'Visible','on');
set(handles.mainMenu,'Visible','off');
PS: the mainMenu was hide and back2mainMenu puchbutton was shwo.
Answers (2)
Walter Roberson
on 22 Dec 2016
1 vote
One possibility is that the panel might be behind another panel or axes. Starting in R2014b, uicontrols and uipanel no longer automatically appear on top when they are visible; if something else covers them up then they will not be visible.
6 Comments
hassan sb
on 23 Dec 2016
Walter Roberson
on 23 Dec 2016
uistack() the uipanel
hassan sb
on 23 Dec 2016
Walter Roberson
on 23 Dec 2016
Please attach your code and your .fig
hassan sb
on 23 Dec 2016
Merse Gaspar
on 6 Jun 2023
But how to set the order?
Image Analyst
on 23 Dec 2016
1 vote
You're using GUIDE so why not just place the panels in GUIDE? Why go to all the tedious trouble to create panels from scratch? For example if your figure units were 'normalized' and your panel units are in 'pixels' then your panels might be off the screen. Make it easy for yourself and just put the panels on there with GUIDE. I mean you're already using GUIDE so why not?
3 Comments
hassan sb
on 23 Dec 2016
Image Analyst
on 23 Dec 2016
You can do it. Just put all the panels up the, put your controls into them. then arrange your panels, overlapping them if wanted. Then just set visibility in your code. But you don't need to recreate them in code, just set their visibility.
hassan sb
on 23 Dec 2016
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!