
! script name: tableforms.d/arrangerow
! topic: Arrange a group of tables in a row

!A
!A NAME:
!A
!A 	Rows Form
!A
!A DESCRIPTION:
!A
!A	This script will allow the user to arrange a group of tables in a row.
!A
!B INSTRUCTIONS:
!B
!B 	JUSTITY:  UL, LL, UR, LR: Enter the position to be used to justify
!B 		the tables in the form.
!B
!B 		UL - Upper Left
!B 		LL - Lower Left
!B 		UR - Upper Right
!B 		LR - Lower Right
!B
!B 	LOCATION X,Y,Z: Enter the X,Y,Z location.
!B
!B 	PICK TABLE #, Proceed: Select the tables to arrange in the row form.
!B 		Proceed will take you back to the JUSTIFY question, to start
!B 		a new column form.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: arrange in a row ")

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

Adjust_y= WsFalse

DeActivateUndo
Start:!

stat= SetInputFormat("a2=",",UL,LL,UR,LR,")
Stat=SetEqualsValue(0,"UL")
Num_lines= GetValue("JUSTITY:  UL, LL, UR, LR ",Answer$)
IF (ExitScript(Destination$)) THEN Leave

SELECT Answer$
CASE "UL"
        Textorig= WsUpperLeft
CASE "LL"
        Textorig= WsLowerLeft
CASE "UR"
        Textorig= WsUpperRight
CASE "LR"
        Textorig= WsLowerRight
CASE ELSE
        Textorig= WsUpperLeft
END SELECT

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

Group1= CreateGroup("TABLES")

Pick_table:!
Tcount= GroupCount(Group1)
IF Tcount=0 THEN
	A$=""
ELSE
	A$= " #"&VAL$(Tcount+1)&" "
END IF
stat= SetInputFormat("a1",",P,")
Table1=PickEntity("PICK TABLE"&A$&":  Proceed ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$= "P" THEN 
	Stat= TablesForm(WsRowForm,Group1,Pc,Textorig,Adjust_y)
	Stat=DeleteEntity(Group1)
	Stat=DeleteEntity(Pc)
	GOTO Start
END IF

IF NOT ValidGeometry(Table1) THEN Pick_table
Etype= EntityType(Table1)
IF Etype= WsDataTableEnt THEN
	Stat= AddToGroup(Group1,Table1)
END IF
Stat= TablesForm(WsRowForm,Group1,Pc,Textorig,Adjust_y)
GOTO Pick_table

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