
! script name: vstrategy.d/vargrouptable
! var_topic: create table from strategy variables

!A
!A NAME:
!A
!A 	Strategy Variable Table.
!A
!A DESCRIPTION:
!A
!A 	This script will make a table from strategy variables.
!A
!B INSTRUCTIONS:
!B
!B	The table will have the strategy variables stripped of the
!B	strategy prefix located in row 1 in the order that they
!B	appear in the strategy.
!B	The name of each variable group will appear in column one.
!B	If no variable groups are present the name will be Default.
!B
!# see also - htdocs/help.d/vdminfo.htm

Stat=ChangeLabelStr("ScriptNameStatus","Function: strategy variable table")

DIM Destination$[512]
DIM Answer$[512]
DIM Filename$[512]
DIM Dir$[512]

DeActivateUndo
Grid_color= 18
Entry_color= 8
Entry_text_height= GetDefault(WsTextHeight)
Entry_text_width= GetDefault(WsTextWidth)

Header_color= 14
Header_ltype= 9
Head_text_height= 1.5*Entry_text_height
Head_text_width= 1.5*Entry_text_width
Header_slant= TAN(20)

Start:!
stat= NamedVarStr("strategy directory",WsStrategyVars,"/usr/weber/database/strategies/",Dir$)
Stat=UserFileBox(Dir$,"*","DIRECTORY","SUB DIRECTORIES","STRATEGY FILES","STRATEGY FILE")
Stat=SetInputFormat("a99","")
Stat=GetValue("SELECT STRATEGY FILE",Filename$)
IF (ExitScript(Destination$)) THEN Leave
IF Filename$= "CANCEL" THEN Leave
LowerFileBox


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

PlotOff
Table1= StrategyVarTable(Filename$,Pc,WsUpperLeft)
Stat= DeleteEntity(Pc)
IF NOT ValidGeometry(Table1) THEN Start

Stat= SetColor(Table1,Grid_color)
Stat= TableTextSizes(Table1,0,0,Entry_text_width,Entry_text_height,Entry_slant)
Stat= TableTextOrigin(Table1,0,0,WsRightCenter)
Stat= SetTableColors(Table1,0,0,Entry_color)

Stat= TableTextOrigin(Table1,0,1,WsLeftCenter)

Stat= TableTextSizes(Table1,1,0,Head_text_width,Head_text_height,Header_slant)
Stat= TableTextOrigin(Table1,1,0,WsCenterText)
Stat= SetTableColors(Table1,1,0,Header_color)
Stat= SetTableLType(Table1,1,0,Header_ltype)
PlotOn

Stat= PlotEntity(Table1)

Leave:!
PlotOn
LowerFileBox
Stat=SetPickMask(WsPickGeometry)
IF NOT LEN(Destination$) THEN
	LOAD "typecontrol"
ELSE
	LOAD Destination$
END IF
END
