Compile function NDW_PRINT_REACTOR_LABELS_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        :   NDW_Print_Reactor_Labels_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)
        01/13/25    djs     Created initial commuter module.

***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
#window NDW_PRINT_REACTOR_LABELS

$Insert APP_INSERTS
$Insert EVENT_SETUP
$Insert MSG_EQUATES

Declare function   Reactor_Services
Declare subroutine PlaceDialog, Labeling_Services

GoToEvent Event for CtrlEntId else
    // Event not implemented
end

Return EventFlow or 1

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Events
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Event WINDOW.CREATE(CreateParam)
    
    ReactNos      = Reactor_Services('GetReactorNumbers')
    Set_Property(@Window:'.COB_REACTOR', 'LIST', ReactNos)
    LoadLockSides = 'Left,Right,Both'
    Convert ',' to @FM in LoadLockSides
    Set_Property(@Window:'.COB_LOAD_LOCK_SIDE', 'LIST', LoadLockSides)
    PlaceDialog(-2, -2)
    
End Event


Event COB_REACTOR.CHANGED(NewData)
	
	GoSub EnablePrintButton
	
end event


Event COB_LOAD_LOCK_SIDE.CHANGED(NewData)
	
	GoSub EnablePrintButton
	
end event


Event PUB_PRINT.CLICK()
	
	ReactNo     = Get_Property(@Window:'.COB_REACTOR', 'TEXT')
	LLSide      = Get_Property(@Window:'.COB_LOAD_LOCK_SIDE', 'TEXT')
	Def         = ""
	Def<MTEXT$> = "Printing label..."
	Def<MTYPE$> = "U"
	MsgUp       = Msg(@window, Def)   ;* display the processing message
	Labeling_Services('PrintReactorLabel', ReactNo, LLSide)
	Msg(@window, MsgUp)         ;* take down the processing message
	If Error_Services('HasError') then Error_Services('DisplayError')
	
end event

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

EnablePrintButton:
	
	ReactNo = Get_Property(@Window:'.COB_REACTOR', 'TEXT')
	LLSide  = Get_Property(@Window:'.COB_LOAD_LOCK_SIDE', 'TEXT')
	Set_Property(@Window:'.PUB_PRINT', 'ENABLED', ( (ReactNo NE '') and (LLSide NE '') ) )	
	
return

