Why the panel was not Visible??

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.

답변 (2개)

Walter Roberson
Walter Roberson 2016년 12월 22일

1 개 추천

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

hassan sb
hassan sb 2016년 12월 23일
Thank you, but how to bring it to the front
Walter Roberson
Walter Roberson 2016년 12월 23일
uistack() the uipanel
It still not work. I add this line
uistack(brightPanel, 'top');
set(brightPanel,'Visible','on');
Walter Roberson
Walter Roberson 2016년 12월 23일
Please attach your code and your .fig
hassan sb
hassan sb 2016년 12월 23일
Here is the project file. The callback is (bright_Callback). Thank you for your help.
Merse Gaspar
Merse Gaspar 2023년 6월 6일
But how to set the order?

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

Image Analyst
Image Analyst 2016년 12월 23일

1 개 추천

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

hassan sb
hassan sb 2016년 12월 23일
I have to hide mainMenu panel and show brightPanel at same position, how I can do this with GUIDE
Image Analyst
Image Analyst 2016년 12월 23일
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
hassan sb 2016년 12월 23일
Ok. That is a good idea. Thank you for help.

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

카테고리

태그

질문:

2016년 12월 22일

댓글:

2023년 6월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by