problem with positioning in GUI

11 Ansichten (letzte 30 Tage)
Raady
Raady am 4 Feb. 2011
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

Akzeptierte Antwort

Davide Ferraro
Davide Ferraro am 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.

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by