Re: CW_FORM woes [message #10257] |
Wed, 05 November 1997 00:00 |
barg
Messages: 3 Registered: September 1997
|
Junior Member |
|
|
David,
I didn't see 'all_tags' in my documentation for compound widgets. Thanks for
the hint. BTW, I understand the reluctance to use COMMON blocks, but in this
example below, I will have around 25 parameters to return to the calling
program. I'm new to IDL, and I'll have to investigate how to do this without
the use of COMMONS.
Again, thanks for your response.
Irene Barg
ibarg@as.arizona.edu
In article <MPG.ec92c8c6ef863ea989696@news.frii.com>, davidf@dfanning.com (David Fanning) writes:
|> [This followup was also posted to comp.lang.idl-pvwave]
|>
|> Irene Barg (barg@nickel.as.arizona.edu) writes:
|>
|> > Can anyone give me an working example of how to use CW_FORM?
|>
|> [...Pretty ugly code with COMMON blocks snipped. :-)...]
|>
|> Here you go.
|>
|> PRO testform_Event, event
|> COMMON params, fsize, fname
|> COMMON b_ids, b
|>
|> CASE event.tag OF
|>
|> 'OK': begin
|> Widget_Control, event.id, Get_Value=alltags
|> fsize = alltags.fsize
|> fname = alltags.fname
|> WIDGET_CONTROL, event.top, /DESTROY
|> end
|>
|> ELSE: ; Drop through event handler
|> ENDCASE
|>
|> END
|>
|>
|> PRO testform
|> COMMON b_ids, b
|> COMMON params, fsize, fname
|>
|> ; describe my form
|> DESC = [ $
|> '0, LABEL, Centered Label, CENTER', $
|> '1, BASE,, ROW, FRAME', $
|> '0, BUTTON, B1|B2|B3, LABEL_TOP=Nonexclusive:, COLUMN, TAG=bg1', $
|> '2, BUTTON, E1|E2|E3, EXCLUSIVE, LABEL_TOP=Exclusive:, COLUMN, TAG=bg2',
|> $
|> '0, TEXT, , LABEL_LEFT=Enter File name:, WIDTH=12, TAG=fname', $
|> '0, INTEGER, 0, LABEL_LEFT=File size:, WIDTH=12, TAG=fsize', $
|> '1, BASE,, ROW', $
|> '0, BUTTON, OK, QUIT, FONT="helvetica", TAG=OK', $
|> '2, BUTTON, Cancel, QUIT']
|>
|> a = WIDGET_BASE(TITLE='Testing IDL forms')
|>
|> b = CW_FORM(a, desc, /COLUMN)
|> WIDGET_CONTROL, a, /REALIZE
|>
|> XMANAGER, 'TESTFORM', a
|> print, 'Filesize: ', fsize
|> print, 'Filename: ', fname
|> END
|>
|>
|> Cheers,
|>
|> David
|>
|> -----------------------------------------------------------
|> David Fanning, Ph.D.
|> Fanning Software Consulting
|> E-Mail: davidf@dfanning.com
|> Phone: 970-221-0438
|> Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: CW_FORM woes [message #10260 is a reply to message #10257] |
Tue, 04 November 1997 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
[This followup was also posted to comp.lang.idl-pvwave]
Irene Barg (barg@nickel.as.arizona.edu) writes:
> Can anyone give me an working example of how to use CW_FORM?
[...Pretty ugly code with COMMON blocks snipped. :-)...]
Here you go.
PRO testform_Event, event
COMMON params, fsize, fname
COMMON b_ids, b
CASE event.tag OF
'OK': begin
Widget_Control, event.id, Get_Value=alltags
fsize = alltags.fsize
fname = alltags.fname
WIDGET_CONTROL, event.top, /DESTROY
end
ELSE: ; Drop through event handler
ENDCASE
END
PRO testform
COMMON b_ids, b
COMMON params, fsize, fname
; describe my form
DESC = [ $
'0, LABEL, Centered Label, CENTER', $
'1, BASE,, ROW, FRAME', $
'0, BUTTON, B1|B2|B3, LABEL_TOP=Nonexclusive:, COLUMN, TAG=bg1', $
'2, BUTTON, E1|E2|E3, EXCLUSIVE, LABEL_TOP=Exclusive:, COLUMN, TAG=bg2',
$
'0, TEXT, , LABEL_LEFT=Enter File name:, WIDTH=12, TAG=fname', $
'0, INTEGER, 0, LABEL_LEFT=File size:, WIDTH=12, TAG=fsize', $
'1, BASE,, ROW', $
'0, BUTTON, OK, QUIT, FONT="helvetica", TAG=OK', $
'2, BUTTON, Cancel, QUIT']
a = WIDGET_BASE(TITLE='Testing IDL forms')
b = CW_FORM(a, desc, /COLUMN)
WIDGET_CONTROL, a, /REALIZE
XMANAGER, 'TESTFORM', a
print, 'Filesize: ', fsize
print, 'Filename: ', fname
END
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|