Compile function DBW_WO_MAT_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_WO_Mat_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_WO_MAT_WAFER_SELECT

$Insert APP_INSERTS
$Insert EVENT_SETUP
$Insert LOGICAL

EQU COL$SLOT			TO 1
EQU COL$WAFER_ID		TO 2
EQU COL$SLOT_NCR		TO 3
EQU COL$MET_NO$			TO 4
EQU COL$MOVED_TO_SLOT	TO 5
EQU COL$MU_WAFER_ID		TO 6
EQU COL$MOVED_FROM_SLOT	TO 7
EQU COL$REPLACED_BY		TO 8
EQU COL$MU_ADD_DATE     TO 9
EQU COL$MU_REM_DATE     TO 10

equ DTM_SELROW$         to  1083

Declare subroutine End_Dialog, Set_Property, Post_Event
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)
        CassNo = Field(CreateParam, '*', 2)
        Set_Property(@Window:'.EDL_WO_NO', 'TEXT', WONo)
        Set_Property(@Window:'.EDL_CASS_NO', 'TEXT', CassNo)
        Post_Event(@Window, 'READ')
    end
    
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


