Hello All,
Can anyone give me an working example of how to use CW_FORM?
I've included the test example given in the IDL Reference Vol 1,
page 314, but I can't figure how to get global variables set
from obtaining tag=value pairs in my CW_FORM. When I run my
testform below, my event handler traps the 'OK' correctly,
but fails on trapping the tag 'fsize'. What I want to do is
when 'OK' is pressed, all tag=value pairs get saved in variables
defined in the COMMON block 'params'.
A simple example would be greatly appreciated.
Thank you in advance.
Irene Barg
ibarg@as.arizona.edu
****testform.pro*****
; testform.pro - example using CW_FORM.
PRO testform_Event, event
COMMON params, fsize, fname
COMMON b_ids, b
IF (event.id EQ b) THEN BEGIN
PRINT, ' '
PRINT, 'CW_FORM B is up!'
ENDIF
IF (event.quit) THEN BEGIN
PRINT, 'Button selected: ', event.value
WIDGET_CONTROL, event.id, /DESTROY
ENDIF
CASE event.tag OF
'OK': begin
HELP, /STRUCTURE, b
WIDGET_CONTROL, event.top, /DESTROY
end
'fsize': begin
; this doesn't work
fsize = event.value
PRINT, 'FSIZE = ', fsize
end
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-medium-r-*-180-*, 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
END
|