problem with positioning in GUI

조회 수: 11 (최근 30일)
Raady
Raady 2011년 2월 4일
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

채택된 답변

Davide Ferraro
Davide Ferraro 2011년 2월 4일
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개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by