TAdvStringGrid

Example 33 : Adding scripting to TAdvStringGrid with TatPascalScripter and TGridScript

vcl grid scripter

TGridScript makes it easy to unleash the full power of the TatPascalScripter component with TAdvStringGrid. With TGridScript and TatPascalScripter, you can make your grid's scriptable in your favourite Pascal language. The TGridScript component exposes most of the TAdvStringGrid properties and methods. If you have not installed TatPascalScripter as part of TMS Scripter, you can download it here

Using TGridScript :

Drop TGridScript on a form. If you want to make just one grid scriptable, assign the grid to the TGridScript Grid property. Next, assign the sourcecode you want to have executed to the TStringList SourceCode property. Start executing the source code by calling the TGridScript Execute method. (For full documentation of the TatPascalScripter from which TGridScript is a descendant class, see Automa)

The default grid is referenced in the source code as Grid. All published properties of TAdvStringGrid are available. For a list of available methods, see below.

If you want multiple grid's to be scriptable, call the TGridScript AddGrid method :

TGridScript.AddGrid(GridName:string; Grid: TAdvStringGrid);

The additional grids are referenced in the sourcecode by the GridName.

List of TAdvStringGrid methods supported in TGridScript :

Cells
SetCells
Floats
SetFloats
Ints
SetInts
SaveToCSV
SaveToFile
SaveToHTML
SaveToASCII
SaveToXLS
SaveToDOC
AppendToHTML
AppendToCSV
LoadFromFile
LoadFromCSV
LoadFromXLS
InsertFromCSV
LoadFromXLSSheet
SaveToXLSSheet
SaveColSizes
LoadColSizes
SaveToXML
SaveToFixed
LoadFromFixed
LoadFromStream
SaveToStream
RemoveRows
InsertRows
RemoveCols
InsertCols
HideColumn
UnhideColumn
HideColumns
UnhideColumns
UnhideColumnsAll
HideRow
UnhideRow
HideRows
UnhideRows
UnhideRowsAll
GroupSum
GroupAvg
GroupMin
GroupMax
GroupCount
Group
UnGroup
CutToClipboard
CutSelectionToClipboard
CopyToClipBoard
CopySelectionToClipboard
PasteFromClipboard
PasteSelectionFromClipboard
QSort
QSortIndexed
QSortGroup
AutoSizeCells
AutoSizeColumns
AutoSizeCol
AutoSizeRows
AutoSizeRow
MergeCols
SwapColumns
MoveRow
MoveColumn
SwapRows
ClearRect
Clear
ClearRows
ClearCols
ClearNormalCells
ClearRowSelect
SelectRows
SelectCols
SelectRange
ShowColumnHeaders
ClearColumnHeaders
ShowRowHeaders
ClearRowHeaders
HideCellEdit
ShowCellEdit
StretchRightColumn
SavePrintSettings
LoadPrintSettings
RandomFill
TextFill
Zoom
AutoNumberCol
AutoNumberRow
Print
PrintRect
AddNode
RemoveNode
IsNode
GetNodeState
SetNodeState
ExpandNode
ContractNode
ExpandAll
ContractAll
ColumnSum
ColumnAvg
ColumnMin
ColumnMax
RowSum
RowAvg
RowMin
RowMax
ClearComboString
AddComboString
AddComboStringObject
RemoveComboString
SetComboSelectionString
SetComboSelection
GetComboCount
GetVersionNr
GetVersionString
HideSelection
UnHideSelection
ScrollInView
IsSelected
ShowInplaceEdit
HideInplaceEdit
RemoveSelectedRows
HideSelectedRows
IsHiddenColumn
IsHiddenRow
NumHiddenColumns
NumHiddenRows
RealRowIndex
RealColIndex
DisplRowIndex
DisplColIndex
GetRealCol
GetRealRow
AddCheckBox
RemoveCheckBox
HasCheckBox
HasDataCheckBox
GetCheckBoxState
SetCheckBoxState
ToggleCheckBox
AddComment
RemoveComment
IsComment
FindFirst
FindNext
AddImageIdx
RemoveImageIdx
GetImageIdx
AddRotated
RemoveRotated
IsRotated
RepaintRect
RepaintCell
RepaintRow
RepaintCol
Include
Exclude
GetDelimiter
SetDelimiter

MarkInCell
MarkInGrid
MarkInCol
MarkInRow
UnMarkInCell
UnMarkInGrid
UnMarkInCol
UnMarkInRow
HilightInCell
HilightInGrid
HilightInCol
HilightInRow
UnHilightInCell
UnHilightInGrid
UnHilightInCol
UnHilightInRow

See TAdvStringGrid helpfile for documentation of methods and parameters.

Delphi project & source files for downloading included in the main demos distribution for Delphi.