Re: Predicting string lengths in widgets [message #55141] |
Mon, 06 August 2007 05:07 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
mattf writes:
> At the moment, I'm just hacking at the problem by using a pixmap
> window and the width parameter in xyouts to get an idea of the string
> length in pixels, e.g., if the string is 'test_str' I do
>
> str_max_sz
> window, /free, /pixmap, xsize = str_max_sz, ysize = str_max_sz
> xyouts, test_str, width = w
> wdelete
> str_pix_len = ceil(w*str_max_sz)
>
> and then use a fudge factor to get good-looking column widths from
> str_pix_len. But there must be a way of doing it, you know,
> correctly... no?
No. :-)
Cheers,
David
P.S. Did you put the phase of the moon into your fudge
factor? That sometimes helps, too.
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|