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

Home » Public Forums » archive » Re: Widget_List resizing problem
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: Widget_List resizing problem [message #7265 is a reply to message #7260] Sat, 26 October 1996 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Brian Jackel <brian.jackel@uwo.ca> writes:

> I'm running IDL 4.0.1 under Windows95, and List Widgets are driving me
> crazy. Specifically, they tend to resize themselves (horizontally) after
> every two or three events (clicks or cursor up/down).

I am not sure about this, because I haven't been around Windows 95 enough
to know for sure, but it appears to me that Windows 95 does a lot of
automatic resizing of widgets. Most of the time, this is what I want, but
I can understand how it might be annoying too.

With respect to list widgets, one thing you might try is to make all
the string elements in the list the same length. Then there will be no
need to resize as you scroll through the list. (At least if you are using
a fixed-spaced font, as you claim.)

Here is a little function of mine that takes a string (or string array)
and pads it with blank characters so that it is always a specified
length. It might be just what you are looking for.

Good luck!

David

***********************************************************

FUNCTION PADSTRING, thisString, length

; This function takes the input string and pads it with blanks
; to make a string of a specified length. The variable
; "thisString" can be a scalar string or an array of strings.
; If "thisString" is longer than the specified length, the
; string is truncated.

ON_ERROR, 1

; Must have one parameter.

IF N_PARAMS() LT 1 THEN $
MESSAGE, 'Must pass at least one parameter to this function.'

; Is first parameter a string?

s = SIZE(thisString)
IF s(s(0) + 1) NE 7 THEN $
MESSAGE, 'First parameter must be a string variable.'

; Define default string length if necessary.

IF N_PARAMS() LT 2 THEN length = 20

; Create a return value (can be an array).

paddedString = thisString

; Do the string padding.

FOR j=0, N_ELEMENTS(thisString)-1 DO BEGIN

; Check to be sure thisString is not too long.

IF N_ELEMENTS(thisString(j)) GT length THEN $
thisString(j) = STRMID(thisString(j), 0, length)

padding = STRING(REPLICATE(32B, length))
STRPUT, padding, thisString(j), 0
paddedString(j) = padding

ENDFOR

RETURN, paddedString
END

*******************************************************

--
David Fanning, Ph.D.
Phone: 970-221-0438
Fax: 970-221-4728
E-Mail: davidf@fortnet.org
[Message index]
 
Read Message
Read Message
Previous Topic: ANNOUNCE: perlDL v1.00 - the 'perl Data Language'
Next Topic: ACR-NEMA reader?

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

Current Time: Sat Oct 11 00:53:05 PDT 2025

Total time taken to generate the page: 1.11983 seconds