; ;------------------------------------------------------------------ ; pro help_event, ev @pltdat.h common helpcom, helpfile ; widget_control,ev.id,get_uvalue=uval case uval of "DONE": begin widget_control,/destroy,ev.top ; quit button return end "PRINT": begin print,' ' print,'Sending file ',helpfile,' to your local printer...' cmd = 'lpr '+helpfile spawn,cmd print,'lpr command done.' print,' ' end else: print,'help: unknown user value=',uval endcase return end ; ;------------------------------------------------------------------- ; pro popup_help,txtfile,title @pltdat.h common helpcom, helpfile ; ; Text of help is in txtfile -- read into string array: ; (label for help type is in title) ; xsize_txt = 75 ysize_txt = 40 on_ioerror,bad openr,lu,txtfile,/get_lun rec = '' nlines = 0 while (not eof(lu)) do begin readf,lu,rec nlines = nlines+1 endwhile txt = strarr(nlines) point_lun,lu,0 for i=0,nlines-1 do begin readf,lu,rec txt(i) = rec endfor close,lu helpfile = txtfile ; helpbase = widget_base(title='HELP'+' ('+title+')',/column,uvalue=title) ; ; Help text: ; base = widget_base(helpbase,/frame,/column) wtxt_help = widget_text(base,no_newline=0,/scroll,value=txt,$ xsize=xsize_txt,ysize=ysize_txt) ; base = widget_base(helpbase,/frame,column=2) done = widget_button(base,value="DONE",uvalue="DONE") print = widget_button(base,value="PRINT THIS HELP FILE",uvalue="PRINT") ; widget_control,helpbase,/realize widget_control,helpbase,tlb_get_size=help_size widget_control,helpbase,tlb_set_xoffset=.5*(1200-help_size(0)) xmanager,'help',helpbase return bad: print,'>>> help: error opening file ',txtfile return end