
! script name: vcontrol.d/recordcalcsoff
! var_topic: turns the calculations in a single record off.

!A
!A NAME:
!A
!A 	Record Calculations Off
!A
!A DESCRIPTION:
!A
!A 	This script will turn off calculations in a single record.
!A
!B INSTRUCTIONS:
!B
!B 	PICK VARIATIONAL RECORD,   Number: Pick the VDM record.
!B
!B 		N - Enter N to allow the VDM record number to be entered.
!B
!B 	PICK VARIATIONAL OBJECT: Pick the VDM object, or enter the
!B 		name of the VDM object containing the record.
!B 		NOTE: This question is only asked if a record number has been
!B 		entered in response to the previous question.
!B
!B 	RECORD # IN OBJECT:  object_name: Enter the VDM record number of the
!B 		selected VDM object.
!B
!B

Stat=ChangeLabelStr("ScriptNameStatus","Function: record calculations off")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
DIM Object_name$[256]
DIM Descr$[256]

DeActivateUndo
Highlight_color=2

Start:!
Pick_record:!
Stat=SetInputFormat("a1",",N,")
E1=PickEntity("PICK VARIATIONAL RECORD,   Number",Answer$)
IF ExitScript(Destination$) THEN Leave
IF Answer$="N" THEN
	GOSUB Pick_object
Record_number:!
	Stat=SetInputFormat("n0","")
	Rec_number=GetValue("RECORD # IN OBJECT: "&Object_name$&"   ")
	IF ExitScript(Destination$) THEN Leave
	Var_record=VObjectRecord(Var_object,Rec_number)
	IF NOT ValidGeometry(Var_record) THEN Record_number
ELSE
	IF NOT ValidGeometry(E1) THEN Pick_record
	Var_record=VarRecordParent(E1)
	IF NOT ValidGeometry(Var_record) THEN Pick_record
	Var_object=VarObjectParent(E1)
	IF NOT ValidGeometry(Var_object) THEN Pick_record
END IF
Stat=Highlight(Var_record,Highlight_color,0)
Stat= RecordCalcToggle(Var_record,WsFalse)

GOTO Pick_record


Pick_object:!
Nobjects= EntityTypeCount(WsVarObjectEnt)
IF Nobjects=1 THEN
	Var_object= CurrentVarObject
	IF NOT ValidGeometry(Var_object) THEN Leave
ELSE
	Var_object=PickVarObject("PICK VARIATIONAL OBJECT")
	IF ExitScript(Destination$) THEN Leave
	IF NOT ValidGeometry(Var_object) THEN Pick_object
END IF
Stat=VarObjectName(Var_object,Object_name$)
RETURN

Leave:!
Stat=SetInputFormat("n4","")
IF NOT LEN(Destination$) THEN
	LOAD "typecontrol"
ELSE
	LOAD Destination$
END IF
END

