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:
set background of uicontrol text box to be transparent?

Subject: set background of uicontrol text box to be transparent?

From: Vihang Patil

Date: 11 May, 2008 08:25:06

Message: 1 of 3

Hello
Is there any way to turn the background of the text box
uicontrol to be transparent?
ex: I have a figure window which has an image displayed on
it. I just want the text part of the uicontrol to be
displayed and want the rest of the part to be transparent
so that I can see the image displayed in the figure window
beneath it.

I have tried this but this doesnt help;

load trees
h1 = figure,
h2 = imshow(X,map);
h=uicontrol('style','text','string','hello');
set(h,'position',[100 150 50 20]);
parentColor = get(get(h, 'parent'), 'color');
set(h,'foregroundcolor', [0 0 0], ...
'backgroundcolor', parentColor);

The above will set the background of the text control to
that of the figure window and not the one of the trees.
Any help?
Vihang

Subject: set background of uicontrol text box to be transparent?

From: Pekka

Date: 12 May, 2008 10:49:03

Message: 2 of 3

"Vihang Patil" <vihang_patil@yahoo.com> wrote in message
<g06ah2$9dh$1@fred.mathworks.com>...
> Hello
> Is there any way to turn the background of the text box
> uicontrol to be transparent?
> ex: I have a figure window which has an image displayed
on
> it. I just want the text part of the uicontrol to be
> displayed and want the rest of the part to be transparent
> so that I can see the image displayed in the figure
window
> beneath it.
>
> I have tried this but this doesnt help;
>
> load trees
> h1 = figure,
> h2 = imshow(X,map);
> h=uicontrol('style','text','string','hello');
> set(h,'position',[100 150 50 20]);
> parentColor = get(get(h, 'parent'), 'color');
> set(h,'foregroundcolor', [0 0 0], ...
> 'backgroundcolor', parentColor);
>
> The above will set the background of the text control to
> that of the figure window and not the one of the trees.
> Any help?
> Vihang


Do you have to use uicontrol?
It doesn't accept BackgroundColor 'none', which is
the default of text objects.
h=text('string','hello','position',[140 150]);

Subject: set background of uicontrol text box to be transparent?

From: Vihang Patil

Date: 12 May, 2008 10:58:03

Message: 3 of 3

"Pekka " <pekka.nospam.kumpulainen@tut.please.fi> wrote in
message <g097av$7vc$1@fred.mathworks.com>...
> "Vihang Patil" <vihang_patil@yahoo.com> wrote in message
> <g06ah2$9dh$1@fred.mathworks.com>...
> > Hello
> > Is there any way to turn the background of the text
box
> > uicontrol to be transparent?
> > ex: I have a figure window which has an image
displayed
> on
> > it. I just want the text part of the uicontrol to be
> > displayed and want the rest of the part to be
transparent
> > so that I can see the image displayed in the figure
> window
> > beneath it.
> >
> > I have tried this but this doesnt help;
> >
> > load trees
> > h1 = figure,
> > h2 = imshow(X,map);
> > h=uicontrol('style','text','string','hello');
> > set(h,'position',[100 150 50 20]);
> > parentColor = get(get(h, 'parent'), 'color');
> > set(h,'foregroundcolor', [0 0 0], ...
> > 'backgroundcolor', parentColor);
> >
> > The above will set the background of the text control
to
> > that of the figure window and not the one of the trees.
> > Any help?
> > Vihang
>
>
> Do you have to use uicontrol?
> It doesn't accept BackgroundColor 'none', which is
> the default of text objects.
> h=text('string','hello','position',[140 150]);
>

Hello Pekka
Yes, I am very much interested to use uicontrol text box,
as it provide me flexibility to pick and place using guide.
The text() function, though solves my purpose but doesnt
give me that flexibilty to pick and place.
Regards
Vihang

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