Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

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: Re: 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: Re: 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

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
transparent uicontrol background Vihang Patil 11 May, 2008 04:30:25
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics