
! script name: datatable.d/colorentry
! topic: Sample - change table entry color

!A
!A NAME:
!A
!A 	Change the color of a table entry
!A
!A DESCRIPTION:
!A
!A 	This script allows the user to change the color of a table entry.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ENTRY: Pick the entry 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 entry ")

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


ActivateUndo
Pen_color= CurrentColor
RaiseColorBox

Start:!

Element_loop:!
stat= SetInputFormat("n4","")
Element1=PickEntity("PICK ENTRY ")
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 entry")
Stat= AddItemToUndo(WsUBModifyMode,Element1)

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

GOTO Element_loop

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