GUI position property issue...
Afficher commentaires plus anciens
Hello all! Well I'm attempting to change the position property of a GUI. I need to display different parts of a GUI at different times. So I have an example here showing two text boxes that show upper data and lower data, I need to resize the GUI to fit the lower data then fit the upper data. I know I can get the lower half easy, but the upper half is being a pain. Here is the example code:
% Make figure 1
f1 = figure('Name','Window 1');
%Add some text boxes
u1 = uicontrol(f1, ...
'Style','text', ...
'String','Upper Data', ...
'Callback','feval(plotf)', ...
'position', [250 380 100 15]);
u1 = uicontrol(f1, ...
'Style','text', ...
'String','Lower Data', ...
'Callback','feval(plotf)', ...
'position', [250 20 100 15]);
%grab current position data
get(gcf,'position')
%so you see both the upper and lower regions
pause(2)
%set new data
set(gcf,'position', [677 610 560 210])
What I need is to find a way to get essentially a position of:
set(gcf,'position', [677 610 560 210:420])
But that code is not the correct way to accomplish this. I need is a way to display the upper regions just like I display the lower regions.
Please help!
Thanks
5 commentaires
Sara
le 11 Juil 2014
I don't understand why you have an interval instead of one value here: 210:420
set(gcf,'position', [677 610 560 210:420])
Chris E.
le 11 Juil 2014
The #4 element of position is the height of the panel, so a range does not make sense. You need to change the position of the bottom border, i.e. element #2. Try this
pos = get(gcf,'position');
set(gcf,'position', [pos(1:3) pos(4)/2])
Is that what you want???
Joseph Cheng
le 11 Juil 2014
yes Sara is absolutely correct. the position parameter properties is [xposition yposition width height].
Chris E.
le 11 Juil 2014
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Cell Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!