Hello All,
I have some experience with writing IDL Programmes and I want to
start using widgets now. I read the examples that come with the IDL manu
al and tried my hand at one example where I would display a picture and rot
ate it by the value set by a slider. However this example does not wor
k. Can anyone fix my small programme (with comments perhaps) so that I ca
n load either file 1 or 2 and dispaly it after proper rotation. Here is the
code I was playing with:
PRO QuitProgramme,event
widget_control,event.top,/DESTROY
return
end
PRO Display1,event
READ_PPM,'flowers.pgm',array
tvscl,array
return
end
PRO Display2,event
READ_PPM,'boy.pgm',array
tvscl,array
return
end
PRO FindAngle,event
widget_control,event.top,get_uvalue=info
print,'###############',event.value
return
end
PRO slider_event,event
widget_control, ev.id, GET_UVALUE=uval
case uval of
'File1' : begin READ_PPM,'flowers.pgm',array
tvscl,array
end
'File2' : begin READ_PPM,'boy.pgm',array
tvscl,array
end
'Quit' : begin Widget_Control,ev.top,/DESTROY
end
ENDCASE
END
PRO slider
base = Widget_Base(Title='28 March 2003',MBAR=menubar,/Column)
menu1 = Widget_Button(menubar,Value='File List',/Menu)
;Create the Menu Items
button1 = Widget_Button(Menu1,Value='File 1',Event_pro='Display1')
button2 = Widget_Button(Menu1,Value='File 2',Event_pro='Display2')
button3 = Widget_Button(Menu1,Value='Quit' ,Event_pro='QuitProgramme')
rot_gp = Widget_Slider(base,max=180,min=0,value=45,Event_pro='FindAng le')
draw = Widget_Draw(base,Xsize=256,ysize=256)
;The text box to show the degrees rotated.
text_box= Widget_text(base,xsize=10)
;make the structure
;READ_PPM,'flowers.pgm',array
;pic = Ptr_new(array)
;info ={ pic:pic, $ ;the picture
; rot_gp:rot_gp } ;the rotation in degrees
Widget_Control, /REALIZE, base
Widget_Control,draw,GET_VALUE=index
WSET,index
Widget_Control, base;, SET_UVALUE=info
XMANAGER,'widget28Mar2003',base
END
Thanks in advance,
Karthik.
|