COMPILE FUNCTION Comm_PRS_Surface(Instruction, Parm1,Parm2)

/*
	Commuter module for PRS_Surface (Product Specification Surface) window
	
	06/11/2004 - John C. Henry, J.C. Henry & Co., Inc.
*/

DECLARE SUBROUTINE Set_Property,  Set_Status, ErrMsg, Set_Property, obj_AppWindow
DECLARE FUNCTION Get_Property, Get_Status, Popup, Send_Message, Msg

$INSERT POPUP_EQUATES
$INSERT MSG_EQUATES
$INSERT APPCOLORS
$INSERT PRS_LAYER_EQU

EQU CRLF$	TO \0D0A\

ErrTitle = 'Error in Comm_PRS_Surface'
ErrorMsg = ''

Result = ''

BEGIN CASE
	CASE Instruction = 'Create' 		; GOSUB Create
	CASE Instruction = 'Refresh'		; GOSUB Refresh
	CASE Instruction = 'Read'			; GOSUB Read
	CASE Instruction = 'Write'			; GOSUB Write
	CASE Instruction = 'Clear'			; GOSUB Clear
	CASE Instruction = 'Close'			; GOSUB Close
	CASE Instruction = 'LUStage'		; GOSUB LUStage
	CASE 1
		ErrorMsg = 'Unknown Instruction passed to routine'
END CASE

RETURN Result


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

obj_Appwindow('Create',@WINDOW)

GOSUB Refresh

RETURN


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

GOSUB Refresh

RETURN


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

GOTO Close

RETURN

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


GOTO Refresh

RETURN

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

obj_Appwindow('DetailReturn')

RETURN

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


Ctrls  = @WINDOW:'.BRIGHTLIGHT':@RM		; Props  = 'CHECK':@RM
Ctrls := @WINDOW:'.SURFSCAN':@RM		; Props := 'CHECK':@RM
Ctrls := @WINDOW:'.MICROSCOPE'			; Props := 'CHECK'

Vals = Get_Property(Ctrls,Props)

BrightLight = Vals[1,@RM]
SurfScan	= Vals[COL2()+1,@RM]
MicroScope	= Vals[COL2()+1,@RM]


IF BrightLight THEN
	Set_Property(@WINDOW:'.BRIGHTLIGHT_GROUP','ENABLED',1)
END ELSE
	Set_Property(@WINDOW:'.BRIGHTLIGHT_GROUP','ENABLED',0)
END

IF SurfScan THEN
	Set_Property(@WINDOW:'.SURFSCAN_GROUP','ENABLED',1)
END ELSE
	Set_Property(@WINDOW:'.SURFSCAN_GROUP','ENABLED',0)
END

IF MicroScope THEN
	Set_Property(@WINDOW:'.MICROSCOPE_GROUP','ENABLED',1)
END ELSE
	Set_Property(@WINDOW:'.MICROSCOPE_GROUP','ENABLED',0)
END

* 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)

RETURN


* * * * * * *
LUStage:
* * * * * * *


ReturnTo = Parm1

IF NOT(INDEX(ReturnTo,'.',1)) THEN
	ReturnTo = @WINDOW:'.':ReturnTo
END

ProdStage = Popup(@WINDOW,'','STAGE')

IF ProdStage NE '' THEN
	obj_Appwindow('LUValReturn',ProdStage:@RM:ReturnTo)
END

RETURN
