PRO qImage_Send, state, confirm=confirm, cancel=cancel

    @compile_opt.pro        ; On error, return to caller

InitVar, confirm, /key

cancel = 0B

widget_control, state.wid_send, get_uvalue=receive

IF state.foreign EQ 0 AND IsType(receive,/defined) THEN BEGIN
    IF widget_info(receive[0], /valid) THEN BEGIN
        wid_child = widget_info(state.wid_qimage_cw, /child)

        widget_control, wid_child, get_uvalue=qimage_cw_state, /no_copy

        sz = long(qimage_cw_state.img_size)

        CASE sz[0]*sz[1] GT 0 OF
        0: ok = 'No'
        1: BEGIN
            CASE confirm OF
            0: ok = 'Yes'
            1: ok = dialog_message('Send box size and pixel value info?', /question, /cancel, dialog_parent=qimage_cw_state.wid_xyz[6])
            ENDCASE

            IF ok EQ 'Yes' THEN widget_control, receive[0], send_event=qImage_SendInfo(qimage_cw_state)
        END
        ENDCASE

        widget_control, wid_child, set_uvalue=qimage_cw_state, /no_copy

        cancel = ok EQ 'Cancel'
    ENDIF
ENDIF

RETURN  &  END