Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

borders around text boxes in GUI

343 views
Skip to first unread message

chirantan mukhopadhyay

unread,
Oct 17, 2000, 2:58:30 AM10/17/00
to
Real quick question: Does anyone know how to add a border around a static
text box in a GUI? For example, the background color for a text box I have
is white, and I want a black border around that. Thanks.

Chirantan


Jordan Rosenthal

unread,
Oct 17, 2000, 3:00:00 AM10/17/00
to
Chirantan,

Actually there is no easy way to do this that I know about. Here's a couple
of ideas:

1) Create another text box underneath the one you have that is slightly
larger and of a different color
2) Create an axis that surrounds the text with something like:

axes('color','none','linewidth',2','box','on', ...
'xcolor','b','ycolor','b','xtick',[],'ytick',[]);

3) If the text is within an axis, draw a patch object underneath it.

To get the sizes right, you will need to use the 'Position' property of the
text and/or perhaps the 'Extent' property.

Hope that helped,

Jordan

"chirantan mukhopadhyay" <cmuk...@students.uiuc.edu> wrote in message
news:Pine.GSO.4.10.100101...@ux12.cso.uiuc.edu...

us.neurology.universityhospital.zurich.switzerland

unread,
Oct 17, 2000, 3:00:00 AM10/17/00
to
do the following

1) create a FRAME with an area slightly larger (say by <dfr>) than the text
box

fgui = uicontrol;
set(fgui,'style','frame');
set(fgui,'position',[x-dfr y-dfr x+bsx+2*dfr
y+bsy+2*dfr],'foregroundcolor',[0 0 0]);

2) create the TEXT box at pos x/y x+bsx y+bsy

tgui = uicontrol;
set(tgui,'style','text');
set(tgui,'position',[x y bsx bsy],... < anything else > ...);

the above <xgui> statements can be merged.
note: it is important that you set the FRAME first! otherwise your text will
be covered (currently, <backgroundcolor> does not accept something like
<none>).

hth
us
sys: i586/w2k.sp1/r12prev


"chirantan mukhopadhyay" <cmuk...@students.uiuc.edu> wrote in message
news:Pine.GSO.4.10.100101...@ux12.cso.uiuc.edu...

us.neurology.universityhospital.zurich.switzerland

unread,
Oct 17, 2000, 3:00:00 AM10/17/00
to
i'm terribly sorry for a lousy mistake in the previous posting

set(fgui,'position',[x-dfr y-dfr x+bsx+2*dfr
y+bsy+2*dfr],'foregroundcolor',[0 0 0]);

should read

set(fgui,'position',[x-dfr y-dfr bsx+2*dfr bsy+2*dfr],'foregroundcolor',[0 0
0]);

as <bsx/y> denote the length of the object.

us

0 new messages