
! script name: datatable.d/sizerow
! topic: auto size a row in a table

!A
!A NAME:
!A
!A 	Row Size
!A
!A DESCRIPTION:
!A
!A 	This script auto sizes a row of entries in a table.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ROW TO BE SIZED: Pick the row to be autosized.
!B
!B 	MINIMUM NUMBER OF LINES: Enter the minimum number of lines in a row.
!B
!# see also - htdocs/help.d/datatables.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: auto size row ")

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

Num_lines=1
Num_chars=0

ActivateUndo
Start:!
N1= DataTableCount
IF N1=0 THEN Leave

Element_loop:!
stat= SetInputFormat("n4","")
Element1=PickEntity("PICK ROW TO BE SIZED")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Element1) THEN Element_loop
T1= LastPickPara

R1=TableParaRow(Element1,T1)
C1=TableParaColumn(Element1,T1)

Stat= SetEntryHighlight(Element1,R1,C1,WsTrue)
Stat= PlotDataTable(Element1,R1,C1,0)

stat= SetInputFormat("n0=","")
Stat=SetEqualsValue(Num_lines)
Num_lines= GetValue("MINIMUM NUMBER OF LINES",Answer$)
IF (ExitScript(Destination$)) THEN
        Stat= SetEntryHighlight(Element1,R1,C1,WsFalse)
        GOTO Leave
END IF


Stat= EraseEntity(Element1)
Stat= SetEntryHighlight(Element1,R1,C1,WsFalse)

ActivateUndo
Stat= AdvanceUndoNumber("size column")
Stat= AddItemToUndo(WsUBModifyMode,Element1)

Stat=AutoSizeTable(Element1,Num_chars,Num_lines,R1,0)
Stat= PlotEntity(Element1)

GOTO Element_loop

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