Re: botton size ? [message #19644] |
Mon, 10 April 2000 00:00 |
mallors
Messages: 76 Registered: November 1997
|
Member |
|
|
In article <MPG.135ba4fb5934ff9989ac0@news.frii.com>,
davidf@dfanning.com (David Fanning) writes:
[cut]
>
> 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).
In the IDL 5.3 WIDGET_DROPLIST documentation under the
XSIZE keyword:
"The desired width of the droplist widget area, in units
specified by the UNITS keyword (pixels are the default)...
This keyword does not control the size of the droplist button
or of the dropped list. Instead, it controls the size "around"
the droplist button and, as such, is not particularly useful."
It's not what we wanted to hear, but it is there :-)
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
Robert S. Mallozzi 256-544-0887
Mail Code SD 50
http://gammaray.msfc.nasa.gov/ Marshall Space Flight Center
http://cspar.uah.edu/~mallozzir/ Huntsville, AL 35812
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
|
|
|
Re: botton size ? [message #19645 is a reply to message #19644] |
Mon, 10 April 2000 00:00  |
mallors
Messages: 76 Registered: November 1997
|
Member |
|
|
In article <38f1eaa1$0$26046@news.execpc.com>,
"pei zeng" <pei@prism-cs.com> writes:
> Hi,
>
> 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?
>
> thanks
Hi,
The GRID_LAYOUT keyword to WIDGET_BASE will do
this in a portable way:
base = WIDGET_BASE (/COLUMN)
grid = WIDGET_BASE (base, COLUMN = 3, /GRID_LAYOUT)
b1 = WIDGET_BUTTON (grid, VALUE = 'Button 1')
b2 = WIDGET_BUTTON (grid, VALUE = 'Button 2, with more text')
b3 = WIDGET_BUTTON (grid, VALUE = 'B')
WIDGET_CONTROL, /REALIZE, base
All buttons will be as wide as the widest "natural width"
button. The natural widths are derived from the button labels.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
Robert S. Mallozzi 256-544-0887
Mail Code SD 50
http://gammaray.msfc.nasa.gov/ Marshall Space Flight Center
http://cspar.uah.edu/~mallozzir/ Huntsville, AL 35812
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
|
|
|
Re: botton size ? [message #19648 is a reply to message #19644] |
Mon, 10 April 2000 00:00  |
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
|
|
|
Re: botton size ? [message #19649 is a reply to message #19644] |
Mon, 10 April 2000 00:00  |
Alex Schuster
Messages: 124 Registered: February 1997
|
Senior Member |
|
|
pei zeng wrote:
> 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?
You can use the XSIZE keyword in the call to WIDGET_BUTTON. It gives the
size in pixels. Maybe the GRID_LAYOUT keyword to WIDGET_BASE also helps.
Alex
--
Alex Schuster Wonko@weird.cologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de
|
|
|