Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
resize problem with uicontrol

Subject: resize problem with uicontrol

From: Mathieu Mathieu

Date: 26 Jul, 2012 14:59:18

Message: 1 of 5

Hi,

I have a problem with these 2 commands:
fid=figure;
uicontrol(fid);

when I execute the second command, it resizes the figure. Do you have any idea why?? And how can I prevent this to happen.

thanks,

Mathieu

Subject: resize problem with uicontrol

From: dpb

Date: 26 Jul, 2012 18:25:33

Message: 2 of 5

On 7/26/2012 9:59 AM, Mathieu Mathieu wrote:
> Hi,
>
> I have a problem with these 2 commands:
> fid=figure;
> uicontrol(fid);
>
> when I execute the second command, it resizes the figure. Do you have
> any idea why?? And how can I prevent this to happen.
...

I've never used a uicontrol so this is a presumption--I presume that
since you don't do anything but the default of creating a control object
that that behavior is result of the defaults in place when nothing else
is specified.

I'd also guess you could change that by using the 'position' property
but that's a (s)wag...

I guess I have the question of what's the point in executing the above
two commands in that fashion? You didn't specify a uicontrol type or
return it's handle or what looks like anything potentially useful...

Well, ok, it's another hot afternoon--I'll play; my very first time for
a uicontrol().

Hmmmm....ok, well on this ancient release (R12, WinXP) the above two
lines result in a default pushbutton drawn at the lower left corner of
the figure. But, the figure isn't resized so that seems a later behavior...

--

--

Subject: resize problem with uicontrol

From: Kristin

Date: 27 Jul, 2012 04:53:24

Message: 3 of 5

"Mathieu Mathieu" wrote in message <jurm06$pde$1@newscl01ah.mathworks.com>...
> Hi,
>
> I have a problem with these 2 commands:
> fid=figure;
> uicontrol(fid);
>
> when I execute the second command, it resizes the figure. Do you have any idea why?? And how can I prevent this to happen.
>
> thanks,
>
> Mathieu

I get the same results as dpb... No resizing is happening in my figure. I'm not sure what your big picture is, but you could always do:

fh = figure;
pos = get(fh, 'position');
uicontrol(fh);
set(fh, 'position', pos);

to get around what you say is happening.

Subject: resize problem with uicontrol

From: Yair Altman

Date: 27 Jul, 2012 06:08:20

Message: 4 of 5

"Mathieu Mathieu" wrote in message <jurm06$pde$1@newscl01ah.mathworks.com>...
> Hi,
>
> I have a problem with these 2 commands:
> fid=figure;
> uicontrol(fid);
>
> when I execute the second command, it resizes the figure. Do you have any idea why?? And how can I prevent this to happen.
>
> thanks,
>
> Mathieu


When you place your uicontrol, the figure's toolbar is removed, thereby reducing the overall height of the figure (and modifying its OuterPosition property). This is a documented side-effect as of R2009b, although it existed as an undocumented side effect for earlier releases as well.

To restore the toolbar simply set(fid,'toolbar','figure');

See http://UndocumentedMatlab.com/blog/uicontrol-side-effect-removing-figure-toolbar

Yair Altman
http://UndocumentedMatlab.com
 

Subject: resize problem with uicontrol

From: Mathieu Mathieu

Date: 30 Jul, 2012 15:00:27

Message: 5 of 5

thanks all, that solved the problem.

Mathieu

"Yair Altman" wrote in message <jutb8k$b6l$1@newscl01ah.mathworks.com>...
> "Mathieu Mathieu" wrote in message <jurm06$pde$1@newscl01ah.mathworks.com>...
> > Hi,
> >
> > I have a problem with these 2 commands:
> > fid=figure;
> > uicontrol(fid);
> >
> > when I execute the second command, it resizes the figure. Do you have any idea why?? And how can I prevent this to happen.
> >
> > thanks,
> >
> > Mathieu
>
>
> When you place your uicontrol, the figure's toolbar is removed, thereby reducing the overall height of the figure (and modifying its OuterPosition property). This is a documented side-effect as of R2009b, although it existed as an undocumented side effect for earlier releases as well.
>
> To restore the toolbar simply set(fid,'toolbar','figure');
>
> See http://UndocumentedMatlab.com/blog/uicontrol-side-effect-removing-figure-toolbar
>
> Yair Altman
> http://UndocumentedMatlab.com
>

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us