PRO Shader_Colors, event ; What kind of event is this? thisEvent = Tag_Names(event, /Structure_Name) CASE thisEvent OF 'WIDGET_BUTTON': XColors, Group_Leader=event.top, $ NotifyID=[event.id, event.top] 'XCOLORS_LOAD': BEGIN Widget_Control, event.top, Get_UValue=info, /No_Copy IF info.truecolor THEN BEGIN WSet, info.wid Shade_Surf, info.data ENDIF Widget_Control, event.top, Set_UValue=info, /No_Copy ENDCASE ENDCASE END PRO Shader, data ; Need data? IF N_Elements(data) EQ 0 THEN data = Dist(30) ; 24 Bit Color Display? Device, Get_Visual_Depth=thisDepth IF thisDepth GT 8 THEN BEGIN Device, Decomposed=0 truecolor = 1 ENDIF ELSE truecolor = 0 ; Load color table. LoadCT, 5, /Silent ; Create widgets. tlb = Widget_Base(Column=1) colors = Widget_Button(tlb, Value='XColors', $ Event_Pro='Shader_Colors') drawID = Widget_Draw(tlb, XSize=400, YSize=400) Widget_Control, tlb, /Realize ; Get window index number, display graphic. Widget_Control, drawID, Get_Value=wid WSet, wid Shade_Surf, data ; Store info structure. info = {data:data, wid:wid, truecolor:truecolor} Widget_Control, tlb, Set_UValue=info, /No_Copy ; Event loop. XManager, 'shader', tlb, /No_Block END