
! script name: datatable.d/colorcolumn
! topic: Sample - color the entries in a column of a table

!A
!A NAME:
!A
!A 	Color entries in a column of a table
!A
!A DESCRIPTION:
!A
!A 	This script will color the entries in a column of a table.
!A
!B INSTRUCTIONS:
!B
!B 	PICK COLUMN: Pick the column to be colored.
!B
!C NOTE:
!C
!C 	This is an unsupported sample script.
!C
!# see also - htdocs/help.d/datatables.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: Color table column ")

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

ActivateUndo
Pen_color= CurrentColor
RaiseColorBox

Start:!

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

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

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

Color1= CurrentColor
Stat= SetTableColors(Element1,0,C1,Color1)
Stat= PlotDataTable(Element1,0,C1,0)

GOTO Element_loop

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