;+ ;NAME: ;thm_ui_help_window ;PURPOSE: ; A widget to display the file 'thm_gui.txt' help ; ;$LastChangedBy: nikos $ ;$LastChangedDate: 2013-04-11 17:00:45 -0700 (Thu, 11 Apr 2013) $ ;$LastChangedRevision: 12025 $ ;$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/tags/tdas_8_00/idl/themis/thm_ui_new/panels/thm_ui_help_window.pro $ ; ;- Pro thm_ui_help_window_event, event widget_control, event.top, get_uval = state getresourcepath,rpath fnamehelp = rpath + 'THEMIS_Users_Guide_THEMIS_Science_Data_Analysis_Software_TDAS_v8.0.pdf' ;catch block for future additions err_xxx = 0 Catch, err_xxx IF (err_xxx NE 0) THEN BEGIN Catch, /Cancel Help, /Last_Message, Output = err_msg thm_ui_sbar_hwin_update, state, err_msg, /error, err_msgbox_title='Error in Help Window' Widget_Control, event.TOP, Set_UValue=state, /No_Copy widget_control, event.top,/destroy RETURN ENDIF ; what happened? widget_control, event.id, get_uval = uval Case uval Of 'EXIT': begin widget_control, event.top, /destroy end 'showhelp' : begin ONLINE_HELP, /FULL_PATH, BOOK=fnamehelp end Endcase Return End Pro thm_ui_help_window, historyWin, gui_id ;catch block for future additions err=0 catch, err if err ne 0 then begin catch,/cancel help,/last_message, output=err_msg if obj_valid(historyWin) then $ for i=0,n_elements(err_msg)-1 do historyWin->update,err_msg[i] ok = error_message('Unknown error, the help window will now close',/noname, $ /center, title='Error in Help Window') widget_control,helpid,/destroy thm_gui_error, gui_id, historywin return endif help_arr = 'No Help File' getresourcepath,rpath fname = rpath+'thm_users_guide_link.txt' if file_test(fname) then begin help_arr = strarr(file_lines(fname)) openr, unit, fname, /get_lun readf, unit, help_arr free_lun, unit endif ;here is the display widget,not editable helpid = widget_base(/col, title = 'Help Window',Group_Leader = gui_id, $ /Modal, /Floating) helpdisplay = widget_text(helpid, uval = 'HELP_DISPLAY', val = help_arr, $ ;xsize = 80, ysize = 40, /scroll, frame = 5) xsize = 140, ysize = 5, /scroll, frame = 5) ;a widget for buttons buttons = widget_base(helpid, /row, /align_center) exit_button = widget_base(buttons, /row, /align_center) onButton = widget_button(exit_button, value = ' Open Help ', uvalue= 'showhelp', /align_center, scr_xsize = 150) exitbut = widget_button(exit_button, val = ' Close ', uval = 'EXIT', /align_center, scr_xsize = 150) state = {help:help_arr, historyWin:historyWin, gui_id:gui_id} CenterTLB, helpid widget_control, helpid, set_uval = state, /no_copy widget_control, helpid, /realize ;keep windows in X11 from snaping back to ;center during tree widget events if !d.NAME eq 'X' then begin widget_control, helpid, xoffset=0, yoffset=0 endif xmanager, 'thm_ui_help_window', helpid, /no_block Return End