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

Home » Public Forums » archive » CW_FORM woes
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: CW_FORM [message #21328 is a reply to message #10263] Tue, 22 August 2000 00:00 Go to previous message
promashkin is currently offline  promashkin
Messages: 169
Registered: December 1999
Senior Member
Aimy wrote:
>
> I want to create a widget that will allow the user to input several
> strings into various fields, and then have a 'Quit' button that when
> pressed will destroy the widget and retain the inputed values.
>
> Below is my code. So far I am unsuccessful at getting CW_FORM to work. Is
> CW_FORM what I should be using? If so, could anyone tell me what I am
> missing in my code?
>
> I would appreciate any help!!
>
> Thanks,
> Aimy

Aimy,
I am not so sure that you need to be using CW_FORM. It is the most
convoluted program in my opinion that comes with IDL. I would much
rather write what you need in plain widget language.
However, I think the only thing that is wrong in your code is the first
"1". Try the following:
==================
pro CmpndWidget

BaseWidget=WIDGET_BASE(Title='Base')

desc = ['0, TEXT, , LABEL_LEFT=File name:, WIDTH=12, TAG=Name', $
'0, BUTTON, OK, QUIT, TAG=OK', $
'2, BUTTON, Cancel, QUIT']

FormWidget=CW_FORM(BaseWidget, desc, /COLUMN)

; Making the widget visible on the screen
WIDGET_CONTROL, /REALIZE, BaseWidget

REPEAT BEGIN
event=widget_event(BaseWidget)
ENDREP UNTIL (event.quit EQ 1)

print, event.VALUE
end
==================

I am not exactly sure what are you accomplishing with the event handling
that you provided, but the above code works. I guess you could use event
structures from other widgets inside that repeat loop.
If I needed what you need, I'd put together something like:
==================
pro test
base = widget_base(title='Base', /column)
filename = cw_field(base, title='File name:')
ok = widget_button(base, value='OK', uvalue='void')
cancel = widget_button(base, value='Cancel', uvalue='void')
widget_control, base, /realize
end
==================
and provided a conventional event handling procedure managed by Xmanager
for it. Takes about 10 lines of code.
Cheers,
Pavel
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Writing to ASCII files
Next Topic: Re: 3-D data, positional vectors, and scaling

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

Current Time: Tue Dec 02 14:19:34 PST 2025

Total time taken to generate the page: 2.24550 seconds