comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: botton size ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: botton size ? [message #19648 is a reply to message #19644] Mon, 10 April 2000 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
pei zeng (pei@prism-cs.com) writes:

> I have a dumb question: when I place 3 button with value 'Apply', 'OK' and
> 'Cancel', respectively, in one row, the buttons will have different size,
> and I can not find a way to make them have the exact same size. Can anybody
> help me?

When a button is created it has a "natural" size that depends
upon the text on the button. Buttons size themselves to fit
what is on them, normally. You can explicitly size buttons
with the Scr_XSize and Scr_YSize keywords, but this is not
always a good idea, since people prefer different fonts,
different font sizes, etc., and your button interface can
end up looking decidedly unprofessional.

Still...you sometimes want a neat, all-the-same-size
look. I know I do. :-)

So what I usually do is this:

1. Create the buttons with their "natural" size.

2. Before I realize the widget hierarchy, I find out
the size of the largest button. The code will look
something like this:

big_size = 0
FOR j=0,2 DO BEGIN
g = Widget_Info(buttonsID[j], Geometry)
big_size = big_size > g.scr_xsize
ENDFOR

3. Make all the buttons the same big size. The code
looks like this:

FOR j=0,2 DO Widget_Control, buttonsID[j], Scr_XSize=big_size

This works with *most* widgets. For example, I find that you
can't resize droplist widgets this way on UNIX platforms
(although the documentation gives no indication that it won't
work). On machines were it works all the time (I.e., Windows),
it works like a charm. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: delete all comp.lang.idl.pvwave,and cancel same
Next Topic: Re: intersection of 2 arrays

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Mon Apr 27 15:37:10 PDT 2026

Total time taken to generate the page: 0.23964 seconds