FUNCTION qImage_TriggerSend, event, wid_qimage_id, wid_receive, wid_send, send_event ;+ ; NAME: ; qImage_TriggerSend ; PURPOSE: ; Set up an interface with a qImage widget to force it to send a QIMAGE_SEND ; event to a specified widget. ; CATEGORY: ; Widget qImage ; CALLING SEQUENCE: ; Status = qImage_TriggerSend(state, event, wid_receive=wid_receive, $ ; wid_send=wid_send, send_event=send_event) ; INPUTS: ; event array[1]; type: structure ; WIDGET_BUTTON event of QIMAGE_SEND event ; wid_qimage_id scalar; type: long integer ; the user value of this widget should contain the widget ID ; of the qImage widget ; wid_receive scalar; type: long integer ; widget ID of a widget to which QIMAGE_SEND events from ; qImage are to be send ; OUTPUTS: ; Status scalar; type: byte ; 0: no qImage widget exists, or event is not valid event (i.e. not ; a WIDGET_BUTTON or QIMAGE_SEND event ; 1: indicates that a qImage widget exists and that 'send_event' ; needs to be send to 'wid_send' ; 2: indicates that 'event' was a QIMAGE_SEND event ; wid_send scalar; type: long integer ; widget ID of qImage 'Send' button to which 'send_event' is to dispatched. ; send_event array[1]; type: structure ; empty WIDGET_BUTTON event to be dispatched to 'wid_send' ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; qImage_SendDestination ; SIDE EFFECTS: ; The existing destination of QIMAGE_SEND events from the qImage widget (if there is one) ; is 'pushed' by appending it to 'wid_receive' and storing the resulting two-element array ; in the user value of the qImage 'Send' button widget. The value is restored again when the ; QIMAGE_SEND event arrives. ; RESTRICTIONS: ; PROCEDURE: ; The first event is a widget button event by e.g. the qView 'Animate' button. ; Check whether a qImage widget exists. If it does then make 'wid_receive' the widget ; to which qImage sends QIMAGE_SEND events; also pick up the widget ID of the 'Send' ; button widget of qImage: messages to this widget generate QIMAGE_SEND events. ; Pass the 'Send' widget ID and an empty message as return arguments in keywords ; 'wid_send' and 'send_events'. These keywords are to be passed back to the main event handler ; and send from there before returning. ; ; The QIMAGE_SEND event send by qImage will end up here again. This is reported to the caller ; by returning status=2B. ; STATE INFO USED: ; widget_control, wid_qimage_id, get_uvalue=wid_qimage ; MODIFICATION HISTORY: ; MAR-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- event_name = tag_names(event, /structure_name) status = 0B widget_control, wid_qimage_id, get_uvalue=wid_qimage CASE event_name OF 'WIDGET_BUTTON': BEGIN IF IsType(wid_qimage,/defined) THEN BEGIN IF widget_info(wid_qimage, /valid) THEN BEGIN ; A qImage widget exists qImage_SendDestination, wid_qimage, wid_receive, wid_send send_event = {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} status = 1B ENDIF ENDIF END 'QIMAGE_SEND': BEGIN IF IsType(wid_qimage,/defined) THEN $ IF widget_info(wid_qimage, /valid) THEN $ ; A qImage widget exists qImage_SendDestination, wid_qimage status = 2B END 'QIMAGE_TRACK': status = 3B 'QIMAGE_GAIN' : status = 4B ELSE: ENDCASE RETURN, status & END