Re: widget_text set_value problem [message #18092 is a reply to message #18091] |
Wed, 01 December 1999 00:00  |
Marc Schellens
Messages: 14 Registered: November 1999
|
Junior Member |
|
|
p3qa3@yahoo.com wrote:
>
> Hi all,
> I want to set a value for a text widget. In my small example this is a
> strarr. I would like to make the widget displaying each string in the
> array in a separate line.
>
> <--------------- SNIP --------------->
>
>> myValue=('first_line','second_line','third_line')
>
>> wid_ID=widget_base()
>> wid_text_ID=widget_text(wid_ID,value=myValue,xsize=200,ysize =10)
>> widget_control,wid_ID,/realize
>
> <--------------- SNAP --------------->
>
> The widget shows the contents of the array in ONE line without newlines.
>
> I tried:
> a) using keywords on widget creation:
> /NO_NEWLINE
> /WRAP
> .... no change.
>
> b) creating a string that contains '\n' (string(10b))
>
> <--------------- SNIP --------------->
>
>> first_line='My first line'
>> separator=string(10b)
>> lines=string(first_line,separator,'My second line')
>> widget_control,wid_text_ID,set_value=lines
>
> <--------------- SNIP --------------->
>
> Now the text widget displays:
> 'My first line|My second line' still in one line.
>
>> print,lines
> results in the correct output.
>
> If I use
>
>> widget_info,wid_text_ID,get_value=myTestValue
>
> myTestValue contains a strarr(1), whatever the size of the original
> strarr
> was that has been used for the widget creation.
>
> Any suggestions/comments appreciated !!
>
I tried your example (replacing the "('first_line..." with
"['first_line...")
As what you wrote is syntactically not correct, I suspect that you
changed something before posting and did not really ues the posted code?
However for me it works fine under Solaris IDL 5.2.
Only I made the experience that if the widgets YSIZE is set to 1 I got
same behaviour as you.
:-) marc
|
|
|