function check_cancel @common_blocks.inc stit = 0 ;a = get_kbrd(0) ; ; uncomment this line if the codes breaks with get_kbrd (there was a ; bug in mac os Leopard where this was necessary) should be fine now. ;a= '' ;if N_elements(a) gt 0 then $ ; if (a[0] eq 'c' or a[0] eq 'C') then begin ; stit = 1 ; endif event = widget_event(CANCEL_BUTTON, /nowait) eventName = Tag_Names(Event, /Structure_Name) if eventName eq "WIDGET_BUTTON" then $ if event.id eq cancel_button then begin stit = 1 print, 'CANCELED by presing cancel button in gui!' endif return, stit end