Compile function DBW_WM_OUT_WAFER_SELECT_EVENTS(CtrlEntId, Event, @PARAMS)
/***********************************************************************************************************************

    This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written
    permission from Infineon.

    Name        :   DBW_WM_Out_Wafer_Select_Events

    Description :   This function acts as a commuter module for all events related to this window.

    Notes       :   Commuter Modules are automatically called from the Promoted_Events function which is called by the
                    application-specific promoted event handler. This makes it possible to add QuickEvents that need to
                    execute Basic+ logic without having use the Form Designer to make the association, although this is
                    limited to the events which are currently promoted.

                    If the form needs to call the commuter module directly then the QuickEvent parameters should be
                    formatted like this:

                        '@SELF','@EVENT',['@PARAM1','@PARAMx']

    Parameters  :
        CtrlEntId   [in] -- The fully qualified name of the control calling the promoted event
        Event       [in] -- The event being executed. See the Notes section regarding "PRE" events
        Param1-15   [in] -- Additional event parameter holders
        EventFlow  [out] -- Set to 1 or 0 so the calling event knows whether or not to chain forward. See comments in
                            EVENT_SETUP insert

    History     :   (Date, Initials, Notes)
        02/01/23    djs     Created initial commuter module.

***********************************************************************************************************************/

#pragma precomp SRP_PreCompiler
#window DBW_WM_OUT_WAFER_SELECT

$Insert APP_INSERTS
$Insert EVENT_SETUP
$Insert LOGICAL

EQU COL$EPP_SLOT        TO 1
EQU COL$EPP_RDS_NO      TO 2
EQU COL$EPP_REACT_NO    TO 3
EQU COL$EPP_RDS_STATUS  TO 4
EQU COL$EPP_POCKET      TO 5
EQU COL$EPP_ZONE        TO 6
EQU COL$EPP_IN_CASS     TO 7
EQU COL$EPP_IN_SLOT     TO 8
EQU COL$EPP_SLOT_NCR    TO 9
EQU COL$EPP_MU_WO_NO    TO 10
EQU COL$EPP_MU_WO_STEP  TO 11
EQU COL$EPP_MU_CASS_NO  TO 12
EQU COL$EPP_MU_SLOT_NO  TO 13
EQU COL$EPP_UMW_CASS_ID TO 14
EQU COL$EPP_UMW_SLOT_NO TO 15
EQU COL$EPP_MU_BY       TO 16
EQU COL$EPP_MU_ADD_DATE TO 17
EQU COL$EPP_MU_REM_DATE TO 18

Declare subroutine End_Dialog, Set_Property, Post_Event, Send_Message
Declare function   Get_Property

GoToEvent Event for CtrlEntId else
    // Event not implemented
end

Return EventFlow or 1

//-----------------------------------------------------------------------------
// EVENT HANDLERS
//-----------------------------------------------------------------------------

Event WINDOW.CREATE(CreateParam)
    
    Send_Message(@Window:'.EDT_SLOTS', 'QUALIFY_EVENT', '0x0111', 1)
    
    If CreateParam then
        WONo   = Field(CreateParam, '*', 1)
        StepNo = Field(CreateParam, '*', 2)
        CassNo = Field(CreateParam, '*', 3)
        Set_Property(@Window:'.EDL_WO_NO', 'TEXT', WONo)
        Set_Property(@Window:'.EDL_STEP_NO', 'TEXT', StepNo)
        Set_Property(@Window:'.EDL_CASS_NO', 'TEXT', CassNo)
        Post_Event(@Window, 'READ')
    end
    
End Event


Event WINDOW.CLOSE(CancelFlag)
    
    End_Dialog(@Window, 'Cancel')
    
end event


Event PUB_OK.CLICK()
    
    SelPos     = Get_Property(@Window:'.EDT_SLOTS', 'SELPOS')
    SelRows    = SelPos<2>
    SelRowData = ''
    If SelRows NE '' then
        WaferList = Get_Property(@Window:'.EDT_SLOTS', 'LIST')
        For each SelRow in SelRows using @VM
            SelRowData<-1> = WaferList<SelRow>
        Next SelRow
    end

    End_Dialog(@Window, SelRowData)
    
end event


Event PUB_CANCEL.CLICK()
    
    End_Dialog(@Window, 'Cancel')
    
end event


Event EDT_SLOTS.WINMSG(hWnd, Message, wParam, lParam)
    
    SelPos  = Get_Property(@Window:'.EDT_SLOTS', 'SELPOS')
    SelRows = SelPos<2>
    Enabled = (SelRows NE '')
    Set_Property(@Window:'.PUB_OK', 'ENABLED', Enabled)
    Set_Property(@Window, 'SAVEWARN', False$)
    
end event


