
! script name: datatable.d/maketable
! topic: create an empty data table

!A
!A NAME:
!A
!A 	New
!A
!A DESCRIPTION:
!A
!A 	Create an empty data table.
!A
!B INSTRUCTIONS:
!B
!B 	NUMBER OF ROWS: Number of rows in table.
!B 		A Row is horizontal.
!B
!B 	NUMBER OF COLUMNS: Number of columns in table.
!B 		A Column is vertical.
!B
!B 	LOCATION: Input or pick the location
!B 		 of the upper left corner.
!B
!C NOTES:
!C
!C 	A datatable is an entity for the display and retention of tabular
!C 	data. A datatable consists of a square array of entries.  The data
!C 	in each entry may be sized, colored, justified, formatted, etc.
!C 	An entry in a table may be picked as an input.  Rows and columns
!C 	may be added at any time.
!C
!# see also - htdocs/help.d/datatables.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: Create data table ")

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


ActivateUndo
Start:!
stat= SetInputFormat("n0","")
Num_rows= GetValue("NUMBER OF ROWS")
IF (ExitScript(Destination$)) THEN Leave
IF Num_rows < 1 THEN Num_rows=1


stat= SetInputFormat("n0","")
Num_cols= GetValue("NUMBER OF COLUMNS")
IF (ExitScript(Destination$)) THEN Leave
IF Num_cols < 1 THEN Num_cols=1


Center_point:Stat=SetInputFormat("n4","")
Pc=XyzInput("LOCATION",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Pc) THEN Center_point

Table1= CreateBlankTable(Pc,"",Num_rows,Num_cols,WsUpperLeft,"        ")
Stat= PlotEntity(Table1)
Stat= DeleteEntity(Pc)

ActivateUndo
Stat= AdvanceUndoNumber("table")
Stat= AddItemToUndo(WsUBCreateMode,Table1)
GOTO Start

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