Grid (Control)

Grid control to display styled spread sheet data.

The Grid Control uses Einhugur Floating Engine 1.3.2 as data container. The floating Engine does not operate like a regular matrix class. When using the Floating Engine you must be aware of that things are not always what they seem, for example then only Cells which have actually been used will exist in memory, cells which contain no data do not exist, and the gap will be filled with a default cell. This means that when you intend to write to a cell and are not sure if it exists then you have to do it with the WritableCell property rather than the Cell property.

Super:
Control (See REALbasic docs for control methods and properties)

Properties:
PROPERTY LockDrawing as Boolean

PROPERTY BackColor as Color (Visible property)
PROPERTY CellColor as Color (Visible property)
PROPERTY GridLineColor as Color (Visible property)
PROPERTY HeaderBackColor as Color (Visible property)
PROPERTY SelectionColor as Color (Visible property)

PROPERTY TextFont as String (Visible property)
PROPERTY TextSize as Integer (Visible property)
PROPERTY TextColor as Color (Visible property)
PROPERTY TextLeftIndent as Integer (Visible property)
PROPERTY TextTopIndent as Integer (Visible property)
PROPERTY TextRightIndent as Integer (Visible property)

PROPERTY Cell(x as Integer, y as Integer) as GridCell
PROPERTY WritableCell(x as Integer, y as Integer) as GridCell

PROPERTY Row(y as Integer) as GridRow
PROPERTY RowHeight(y as Integer) as Integer
PROPERTY RowVisible(y as Integer) as Boolean

PROPERTY CellText(x as Integer, y as Integer) as String

PROPERTY Cols as Integer (Visible property)
PROPERTY Rows as Integer (Visible property)

PROPERTY ColumnAlignment(Col as Integer) as Integer
PROPERTY ColumnHeaderAlignment(Col as Integer) as Integer
PROPERTY ColumnWidth(Col as Integer) as Integer
PROPERTY ColumnMinWidth(Col as Integer) as Integer

PROPERTY DefaultColumnWidth as Integer (Visible property)
PROPERTY DefaultRowHeight as Integer (Visible property)

PROPERTY HeaderHeight as Integer (Visible property)

PROPERTY SelectedCol as Integer *
PROPERTY SelectedRow as Integer *
PROPERTY SelectedColEnd as Integer *
PROPERTY SelectedRowEnd as Integer *

PROPERTY SelectEntireRow as Boolean (Visible property)
PROPERTY AreaSelection as Boolean (Visible property)

PROPERTY HorizontalGrid as Boolean (Visible property)
PROPERTY VerticalGrid as Boolean (Visible property)

PROPERTY HorizontalScrollbar as Boolean (Visible property)
PROPERTY HScrollValue as Integer
PROPERTY VScrollValue as Integer
PROPERTY ShowResizeGlyph as Boolean (Visible property)

PROPERTY CornerBtnEnabled as Boolean (Visible property)
PROPERTY RenderSortOrder as Boolean (Visible property)

PROPERTY SortedBackwardsFlag as Boolean

PROPERTY DataPtr as GridMatrix
PROPERTY RowSet as GridObjectArray


PROPERTY Header(Col as Integer) as GridCell

* = Read only property.

Methods:
AppendRow(Row as GridRow)
AppendRow(Value as String)

InsertRow(Where as Integer,Row as GridRow)
InsertRow(Where as Integer,Value as String)
RemoveRow(Where as Integer)
RemoveRow(Where as Integer,Count as Integer)

InsertCol(Where as Integer,NewLabel as String)
RemoveCol(Where as Integer)

DrawCell(x as Integer, y as Integer)
EditCell(x as Integer, y as Integer)
SelectCell(x as Integer, y as Integer)

SwapRows(rowA as Integer,rowB as Integer)

CellBounds(x as Integer, y as Integer,
ByRef left as Integer,
ByRef top as Integer,
ByRef width as Integer,
ByRef height as Integer)

CellFromPoint(x as Integer, y as Integer,
ByRef CellX as Integer,
ByRef CellY as Integer)

FUNCTION GetDefaultCell() as GridCell
ResynchronizeContainer()

MoveSelectionLeft()
MoveSelectionRight()
MoveSelectionUp()
MoveSelectionDown()

Events:
CellDblClick(CellX as Integer, CellY as Integer,
x as Integer, y as Integer)

CellGotSelected(X as Integer, Y as Integer)

ColumnHeaderClick(Column as Integer)

CornerBtnClick

FUNCTION KeyDown(charCode as Integer, keyCode as Integer,
modifiers as Integer) as Boolean

GotFocus

LostFocus

FUNCTION MouseDown(x as Integer, y as Integer) as Boolean

MouseUp(x as Integer, y as Integer)

FUNCTION MouseDrag(x as Integer, y as Integer) as Boolean

OnEditCell(x as Integer,y as Integer,
CellLeft as Integer, CellTop as Integer,
CellWidth as Integer, CellHeight as Integer,
xCord as Integer, yCord as Integer)

RenderCornerBtn(Left as Integer, Top as Integer,
Right as Integer, Bottom as Integer,
isDown as Boolean)

OnHScroll

OnVScroll

ControlCreated


Supported platforms:
* MacOS PPC
* MacOS Carbon
* Windows x86
(Because of REALbasic plugin limitations in the Win32 targets then the x86 part comes as it is,
without any promises, we could not stall this release for more months waiting for fixes in REALbasic)