
! script name: vdatatable.d/entrytextbox
! var_topic: entry text box toggle

!A
!A NAME:
!A
!A 	Text Box Toggle	   VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script turns on/off a box around the text entry.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ENTRY: Pick the entry to be changed.
!B
!B      In the FreeParameters specifing Row and Column numbers.
!B      If Row is set to 0 it box all rows having the column number.
!B      If Column is set to 0 box all columns having the row number.
!B      If both are zero it will box the entire table.
!B
!# see also - htdocs/help.d/datatables.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: Box toggle ")

DIM Answer$[256]
DIM A$[256]
DIM Destination$[256]
DIM Table$[256]

Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave
DEG

ActivateUndo
Start:!
Element_loop:!
stat= SetInputFormat("n4a1",",R,C,")
Element1=PickEntity("PICK ENTRY  Row, Column ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
SELECT Answer$
CASE "R"
        stat= SetInputFormat("n4","")
        Element1=PickEntity("PICK TABLE ROW")
        IF (ExitScript(Destination$)) THEN Leave
        IF NOT ValidDependency(Element1) THEN Element_loop
        Stat= EntityNameCheck(Element1,Table$)
        T1= LastPickPara
        R1=TableParaRow(Element1,T1)
        C1=0
CASE "C"
        stat= SetInputFormat("n4","")
        Element1=PickEntity("PICK TABLE COLUMN")
        IF (ExitScript(Destination$)) THEN Leave
        IF NOT ValidDependency(Element1) THEN Element_loop
        Stat= EntityNameCheck(Element1,Table$)
        T1= LastPickPara
        R1=0
        C1=TableParaColumn(Element1,T1)
CASE ELSE
        IF NOT ValidDependency(Element1) THEN Element_loop
        Stat= EntityNameCheck(Element1,Table$)
        T1= LastPickPara
        R1=TableParaRow(Element1,T1)
        C1=TableParaColumn(Element1,T1)
END SELECT


ActivateUndo
Stat= AdvanceUndoNumber("wntry text box")
Stat= AddItemToUndo(WsUBModifyMode,Element1)


Stat= PlotDataTable(Element1,R1,C1,-1)
RecordFunctionOn
Stat= RecordDescr("TABLE: Entry Text Box")
V1= FreeParameter("On",1)
V2= FreeParameter("Row",R1)
V3= FreeParameter("Column",C1)
Stat= SetEntryTextBox(Table$,V2,V3,V1)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord
Stat= PlotDataTable(Element1,R1,C1,0)

Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
GOTO Element_loop

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