PRO COLOR_EXAMPLE_CHANGE_COLORS, event ; Handles color table loading events. Allows colors be to changed. Widget_Control, event.top, Get_UValue=info, /No_Copy thisEvent = Tag_Names(event, /Structure_Name) CASE thisEvent OF 'WIDGET_BUTTON': BEGIN ; Color table tool. The NOTIFYID keyword identifies a widget ; that should be notified when the color table vectors are ; changed. XColors, Group_Leader=event.top, NotifyID=[event.id, event.top] ENDCASE 'XCOLORS_LOAD': BEGIN ; Update the display for 16-bit and 24-bit displays ; when color table vectors are loaded and XCOLORS ; sends notification of that fact. Device, Get_Visual_Depth=thisDepth IF thisDepth GT 8 THEN BEGIN WSet, info.wid TV, info.image ENDIF ENDCASE ENDCASE Widget_Control, event.top, Set_UValue=info, /No_Copy END PRO COLOR_EXAMPLE ; Create some data. image = Rebin(Dist(200), 400, 400) ; Create widgets. tlb = Widget_Base(Column=1, Base_Align_Center=1, $ XOffset=200, YOffset=200) button = Widget_Button(tlb, Value='Change Image Colors', $ Event_Pro='COLOR_EXAMPLE_CHANGE_COLORS') drawID = Widget_Draw(tlb, XSize=400, YSize=400) Widget_Control, tlb, /Realize Widget_Control, drawID, Get_Value=wid ; Load color table and display image. LoadCT, 5 WSet, wid TV, image ; Create info structure. info = {image:image, wid:wid} Widget_Control, tlb, Set_UValue=info, /No_Copy XManager, 'color_example', tlb, /No_Block END