PRO qImage_SendDestination, wid_qimage, wid_receive, wid_send, foreign=foreign, boxes=boxes ;+ ; NAME: ; qImage_SendDestination ; PURPOSE: ; Set the destination of QIMAGE_SEND events for a qImage widget ; CATEGORY: ; Widget qImage ; CALLING SEQUENCE: ; qImage_SendDestination, wid_qimage, wid_receive, wid_send ; qImage_SendDestination, wid_qimage ; INPUTS: ; wid_qimage scalar; type: long integer ; the widget ID of the qImage widget ; OPTIONAL INPUT PARAMETERS: ; wid_receive scalar; type: long integer ; the widget ID of the widget to receive QIMAGE_SEND events ; If not specified then the previous "Send" destination is restored. ; OUTPUTS: ; wid_send scalar; type: long integer ; the widget ID of the 'Send' widget in the qImage widget ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; IsType ; RESTRICTIONS: ; The widget ID used should be valid. There is no internal check for this. ; PROCEDURE: ; If there already is a "Send" destination this is saved by concatenating it to the ; input 'receive' value and storing the resulting 2-element array in the user value of ; 'wid_send'. The original value is restored if 'receive' is not specified. ; STATE INFO USED: ; widget_control, wid_qimage, get_uvalue=qimage_state, /no_copy ; widget_control, wid_send, get_uvalue=receive, /no_copy ; STATE INFO MODIFIED: ; widget_control, wid_qimage, set_uvalue=qimage_state, /no_copy ; widget_control, wid_send, set_uvalue=receive, /no_copy ; MODIFICATION HISTORY: ; FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- widget_control, wid_qimage, get_uvalue=qimage_state, /no_copy ; Get qImage state structure wid_send = qimage_state.wid_send widget_control, wid_send, get_uvalue=receive, /no_copy CASE IsType(wid_receive,/defined) OF ; Restore 'Send' destination 0: BEGIN IF n_elements(receive) GT 1 THEN BEGIN receive = receive[1] widget_control, wid_send, set_uvalue=receive, /no_copy ENDIF END 1: BEGIN IF n_elements(receive) EQ 0 THEN receive = wid_receive ELSE receive = [wid_receive, receive] widget_control, wid_send, set_uvalue=receive, /no_copy ; Change the 'Send' destination END ENDCASE IF IsType(foreign,/defined) THEN qimage_state.foreign = foreign IF IsType(boxes ,/defined) THEN qimage_state.boxes = boxes widget_control, wid_qimage, set_uvalue=qimage_state, /no_copy RETURN & END