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.

Respuestas (2)

Walter Roberson
Walter Roberson el 22 de Dic. de 2016

1 voto

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 comentarios

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

Iniciar sesión para comentar.

Image Analyst
Image Analyst el 23 de Dic. de 2016

1 voto

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 comentarios

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

Iniciar sesión para comentar.

Etiquetas

Preguntada:

el 22 de Dic. de 2016

Comentada:

el 6 de Jun. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by