Hi.
I wish to convert a GUI procedure writtern in IDL ,to its equilvalent
function so that I am
able to return values back to the calling procedure. Since the
procedure doesnt return the values , I need the function to do the
same.
I am posting the procedure listing along with this mail.Kindly someone
please
tell me the way to convert it to a correspondidng function so that I
can return
the input variable back to calling procedure.
TIA
-shishir
*---------Listing of wid_input.pro--------------*
pro wid_input_event, ev
WIDGET_CONTROL, ev.id, GET_VALUE=input
if(input eq 'OK') then $
WIDGET_CONTROL, ev.top, /DESTROY $
else if(input eq 'Cancel') then $
Result = DIALOG_MESSAGE('You have not entered the Discharge Value',
/INFORMATION , $
TITLE='Warning')$
else WIDGET_CONTROL, ev.id, SET_VALUE=''
end
pro wid_input,type ;basically type is passed as a parameter to this
procedure
type='injection' ;here i have taken a default value to run it alone.
;type='pumping'
case type of
'pumping':begin
base = WIDGET_BASE(XOFFSET=5 ,YOFFSET=5 ,SCR_XSIZE=180 ,SCR_YSIZE=100
$
,TITLE='Discharge Input' ,SPACE=3 ,XPAD=3 ,YPAD=3
,TLB_FRAME_ATTR=1)
field = CW_FIELD(base, TITLE = "Enter the Discharge Value",
/FRAME,/RETURN_EVENTS,XSIZE=4)
button1 = WIDGET_BUTTON(base, VALUE='OK', UVALUE='Ok',XOFFSET=20
,YOFFSET=40 ,SCR_XSIZE=60 $
,SCR_YSIZE=20,/ALIGN_CENTER)
button2 = WIDGET_BUTTON(base, VALUE='Cancel',
UVALUE='CANCEL',XOFFSET=90 ,YOFFSET=40 $
,SCR_XSIZE=60 ,SCR_YSIZE=20,/ALIGN_CENTER)
end
'injection':begin
base = WIDGET_BASE(XOFFSET=5 ,YOFFSET=5 ,SCR_XSIZE=320 ,SCR_YSIZE=140
$
,TITLE='Injection Well Input' ,SPACE=3 ,XPAD=3 ,YPAD=3
,TLB_FRAME_ATTR=1,/COLUMN)
field1 = CW_FIELD(base, TITLE = "Enter the Discharge Value",
/FRAME,/RETURN_EVENTS,XSIZE=4)
field2 = CW_FIELD(base, TITLE = "Enter the Concentration Value",
/FRAME,/RETURN_EVENTS,XSIZE=4)
Bbase = WIDGET_BASE(base,XOFFSET=5 ,YOFFSET=80 ,SCR_XSIZE=320
,SCR_YSIZE=30 $
,SPACE=3 ,XPAD=3 ,YPAD=3 ,TLB_FRAME_ATTR=1)
button1 = WIDGET_BUTTON(Bbase, VALUE='OK', UVALUE='Ok',XOFFSET=70
,YOFFSET=5 ,SCR_XSIZE=60 $
,SCR_YSIZE=20,/ALIGN_CENTER)
button2 = WIDGET_BUTTON(Bbase, VALUE='Cancel',
UVALUE='CANCEL',XOFFSET=140 ,YOFFSET=5 $
,SCR_XSIZE=60 ,SCR_YSIZE=20,/ALIGN_CENTER)
end
ENDCASE
WIDGET_CONTROL, base, SET_UVALUE=field
;WIDGET_CONTROL, field, SET_VALUE=''
WIDGET_CONTROL, base, /REALIZE
XMANAGER, 'wid_input', base,/JUST_REG
end
|