problem with positioning in GUI
3 views (last 30 days)
Show older comments
i am developing a gui with UI controls, when I am defining the size the of the figure to appear, It displays the whole screen, all the other uicontrols are placed properly.
I tried out just just the command line with f=.... in seperate window changing various values in 'pos', but it shows the full screen. any suggestions would be helpful.
function fnt()
pos = [10,10,490,650];
col= [0.831 0.816 0.784];
f = figure('name','Project','numbertitle','off',...
'menubar','none','units','normalized',...
'color',col,'position', pos)
movegui(f,'center')
col=get(f,'color');
%Name plate
uicontrol('style','text','string','Selected Files',...
'position',[35,600,80,18],'backgroundcolor', col);
%creates a list box
uicontrol('style','listbox','position',[30,500,270,100],...
'foregroundcolor', [0 0 0],'backgroundcolor', [1 1 1]);
end
0 Comments
Accepted Answer
Davide Ferraro
on 4 Feb 2011
If you are working with normalized units you should use position values between 0 and 1 to set the position.
The following code creates a figure that is not taking the whole screen:
f = figure('name','Project','numbertitle','off',...
'menubar','none','units','normalized',...
'color',col,'position', [0.1 0.1 0.3 0.5])
I would suggest you to keep using normalized units also for all UICONTROL objects.
0 Comments
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps 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!