COMPILE FUNCTION React_Injector(EntID,Event,Parm1,Parm2,Parm3,Parm4,Parm5)

/*
	Commuter module for React_Injector window
	
	02/10/2014 - John C. Henry, J.C. Henry & Co., Inc.
*/

DECLARE SUBROUTINE Set_Property, ErrMsg, obj_Appwindow, Btree.Extract, Send_Event
DECLARE FUNCTION Get_Property, Send_Message, NextKey, Popup

$INSERT APPCOLORS
$INSERT POPUP_EQUATES

EQU COL$REACT_NO			TO 1
EQU COL$SVC_HRS				TO 2
EQU COL$SVC_WFRS			TO 3
EQU COL$RDS_WAFER_COUNT		TO 4
EQU COL$PCRC				TO 5
EQU COL$INST_DTM			TO 6
EQU COL$INST_REACT_HRS		TO 7
EQU COL$INST_REACT_WFRS		TO 8
EQU COL$INST_RL_ID			TO 9
EQU COL$REM_DTM				TO 10
EQU COL$REM_REACT_HRS		TO 11
EQU COL$REM_REACT_WFRS		TO 12
EQU COL$REM_RL_ID			TO 13

EQU SPECIAL_BLUE$	TO 227 + (253*256) + (248*65536)

ErrTitle = 'Error in React_Injector'
ErrorMsg = ''

Result = ''

BEGIN CASE
	CASE EntID = @WINDOW
		BEGIN CASE
			CASE Event = 'CLEAR'			; GOSUB Clear
			CASE Event = 'CREATE' 			; GOSUB Create
			CASE Event = 'CLOSE'			; GOSUB Close
			CASE Event = 'WRITE'			; GOSUB Write
			CASE Event = 'READ'				; GOSUB Read
			CASE Event[1,3] = 'QBF'			; GOSUB Refresh
		END CASE
		
	
	CASE EntID = @WINDOW:'.LU_REACT_NO' AND Event = 'CLICK'		; GOSUB LUReactor
	CASE EntID = @WINDOW:'.LU_INJ_TYPE' AND Event = 'CLICK'		; GOSUB LUInjType
	

	CASE 1
		
		ErrorMsg = 'Unknown Parameters ':EntID:' - ':Event:' passed to commuter'
		ErrMsg(ErrorMsg)
		
END CASE

IF ErrorMsg NE '' THEN
	ErrMsg(ErrTitle:@SVM:ErrorMsg)
END

RETURN Result


* * * * * * *
Create:
* * * * * * *


obj_Appwindow('Create',@WINDOW)

RETURN



* * * * * * *
Close:
* * * * * * *

*DEBUG

RETURN



* * * * * * *
Read:
* * * * * * *



GOSUB Refresh

RETURN

* * * * * * *
Write:
* * * * * * *



RETURN


* * * * * * *
Clear:
* * * * * * *

*Send_Event(@WINDOW,'PAGE',1)



* * * * * * *
Refresh:
* * * * * * *


* QBF buttons

Ctrls  = @WINDOW:'.QBF_FIRST_FIX':@RM		; Props  = 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_PREV_FIX':@RM		; Props := 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_ABS_FIX':@RM			; Props := 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_NEXT_FIX':@RM		; Props := 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_LAST_FIX':@RM		; Props := 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_STOP_FIX'			; Props := 'ENABLED'

IF Get_Property(@WINDOW,'QBFLIST') = '' THEN
	Vals = 0:@RM:0:@RM:0:@RM:0:@RM:0:@RM:0
END ELSE
	Vals = 1:@RM:1:@RM:1:@RM:1:@RM:1:@RM:1
END

Set_Property(Ctrls,Props,Vals)



* Turn edit table symbolic column backgrounds to green **************************************************

/*
ETSymbolics = Get_Property(@WINDOW,'@ET_SYMBOLICS')		;* Loaded during 'Create' in obj_Appwindow

ETCtrls	= ETSymbolics<1>
ETCols	= ETSymbolics<2>

FOR I = 1 TO COUNT(ETCtrls,@VM) + (ETCtrls NE '')
	ETCtrl	= ETCtrls<1,I>
	ETList = Get_Property(ETCtrl,'LIST')
	FOR Line = 1 TO COUNT(ETList,@FM) + (ETList NE '')
		IF ETList<Line,1> NE '' THEN
			FOR N = 1 TO COUNT(ETCols<1,I>,@SVM) + (ETCols<1,I> NE '')
				stat = Send_Message(ETCtrl,'COLOR_BY_POS',ETCols<1,I,N>,Line,GREEN$)
			NEXT N
		END
	NEXT I
NEXT I

*/




RETURN


* * * * * * *
LUReactor:
* * * * * * *

FocusControl	= Parm1
FocusPos 		= Parm2

ReactorNo = Popup(@WINDOW,'','REACTORS')

IF ReactorNo = '' THEN RETURN

IF INDEX(ReactorNo,@VM,1) THEN
	CONVERT @VM TO @FM IN  ReactorNo
	Send_Event(@WINDOW,'CLEAR')
	Set_Property(@WINDOW,'QBFLIST',ReactorNo)
	Send_Event(@WINDOW,'QBFFIRST')
	GOSUB Refresh
END ELSE
	obj_Appwindow('LoadFormKeys',@WINDOW:@RM:ReactorNo)
END

RETURN




* * * * * * *
LUInjType:
* * * * * * *

RetVal = Popup(@WINDOW,'','REACT_INJ_TYPE')

IF RetVal NE '' THEN
	oaParms = RetVal:@RM:@WINDOW:'.INJ_TYPE'
	obj_Appwindow('LUValReturn',oaParms)
END

RETURN


