problem with positioning in GUI

3 ビュー (過去 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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by