
! script name: processtable.d/tableinput
! topic: Change an entry in the process table

!A
!A NAME:
!A
!A 	Change Entry in Process Table
!A
!A DESCRIPTION:
!A
!A 	This script allows changes to be made to the process table.
!A	This script will only allow the user to change entries in
!A	the tool numbers, feed, and speed columns.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ENTRY: Pick the entry to be changed.
!B
!B 	INPUT NEW ENTRY: Enter the entry.
!B
Stat=ChangeLabelStr("ScriptNameStatus","Function: table input ")

DIM Answer$[256]
DIM A$[256]
DIM B$[256]
DIM A1$[256]
DIM Destination$[256]
DIM Format$[256]
DIM Data_name1$[256],Work_zone1$[256]
DEG

IF NOT ValidGeometry("Amo process table") THEN Leave

ActivateUndo
Start:!
Etype= WsNumericEntry
Format$="noformat"

Element_loop:!
stat= SetInputFormat("n4","")
Table1=PickEntity("PICK ENTRY ")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Table1) THEN Element_loop
IF IsEntityDependent(Table1) THEN
	Stat= MessageFileBox("/usr/weber/database/messages/vdmprtbl","ERROR")
	GOTO Element_loop
END IF

T1= LastPickPara
R1=TableParaRow(Table1,T1)
IF R1=1 THEN Element_loop
C1=TableParaColumn(Table1,T1)
IF C1<=4 THEN Element_loop

Stat= GetTableEntryStr(Table1,R1,1,Data_name1$)
Stat= GetTableEntryStr(Table1,R1,2,Work_zone1$)

Stat= PlotDataTable(Table1,R1,C1,-1)
Stat= SetEntryHighlight(Table1,R1,C1,WsTrue)
Stat= PlotDataTable(Table1,R1,C1,0)

Stat= SetInputFormat("n4=","")
stat= SetEqualsValue(Value)
Value= GetValue("INPUT NEW ENTRY")
IF (ExitScript(Destination$)) THEN
	Stat= PlotDataTable(Table1,R1,C1,-1)
	Stat= SetEntryHighlight(Table1,R1,C1,WsFalse)
	Stat= PlotDataTable(Table1,R1,C1,0)
	GOTO Leave
END IF
Stat= EraseEntity(Table1)
Stat= SetEntryHighlight(Table1,R1,C1,WsFalse)

B$= "CHANGE ENTRY: "&VAL$(Value)

ActivateUndo
Stat= AdvanceUndoNumber("change entry")
Stat= AddItemToUndo(WsUBModifyMode,Table1)

Row= ProcessTableRow(Table1,Data_name1$,Work_zone1$)
Stat=InsertIntoTable(Table1,Value,Format$,Row,C1)
Stat= PlotEntity(Table1)

GOTO Element_loop

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