RaGrid

Advanced grid custom control.

(See RaGrid.png)

Summary
RaGridAdvanced grid custom control.
AddCreate control.
AddColumnAdd column.
AddRowAdd row.
CellConvertConvert cell.
ComboAddStringPopulate combo box.
ComboClearClear combo box.
EnterEditEdit cell.
EndEditEnd cell editing.
DeleteRowDelete row.
GetCellGet cell value.
GetCellRectGet cell rect.
GetColFormatGet column format.
GetColCountReturns number of columnns.
GetColWidthGet column width.
GetColorsGet colors.
GetColumnGet column parameters.
GetCurrentCellGet current cell.
GetCurrentColGet current column .
GetCurrentRowGet currently selected row.
GetHdrHeightGet height of the header row.
GetHdrTextGet header text.
GetRowColorGet row color.
GetRowHeightGet height of the row.
GetRowCountReturns number of rows.
MoveRowMove row.
ResetContentReset content of the control.
ResetColumnsReset columns of the control.
ScrollCellScrolls current cell into view.
SetCellSet cell value.
SetColorsSet colors.
SetColWidthSet column width.
SetColFormatSet column format.
SetCurrentRowSet current row.
SetCurrentColSet current column.
SetCurrentCellSet current cell.
SetFontSets the control font.
SetHdrHeightSet height of the header row.
SetHdrTextSet header text.
SetRowColorSet row color.
SetRowHeightSet height of the row.
SortSort column.
About

Add

RG_Add(HParent,  
X,  
Y,  
W,  
H,  
Style = "",
Handler = "",
DllPath = "")

Create control.

Parameters

X..HPosition of the control.
StyleSpace separated list of control styles, by default both scroll bars are visible.  You can use numbers or style strings.
HandlerNotification events handler.
DllPathPath of the control dll, by default control is searched in the current folder.

Styles

NOSEL, NOFOCUS, HGRIDLINES, VGRIDLINES, GRIDLINES, GRIDFRAME, NOCOLSIZE.

Handler

Result := Handler(HCtrl, Event, Col, Row, Data )
HCtrlControl sending the event.
EventSpecifies event that occurred.  Event must be registered to be able to monitor it.
Col,RowCell coordinates.
DataNumeric data of the cell.  Pointer to string for textual cells and DWORD value for numeric.
ResultReturn 1 to prevent action.

Events

HeaderclickSent when user clicks header.
ButtonclickSent when user clicks the button in a button cell.
CheckclickSent when user double clicks the checkbox in a checkbox cell.
ImageclickSent when user double clicks the image in an image cell.
BeforeselchangeSent when user request a selection change.
AfterselchangeSent after a selection change.
BeforeeditSent before the cell edit control shows.
AftereditSent when the cell edit control is about to close.
BeforeupdateSent before a cell updates grid data.
AfterupdateSent after grid data has been updated.
UserconvertSent when user cell needs to be converted.

Returns

Control’s handle.

AddColumn

RG_AddColumn(hGrd,  
o1 = "",
o2 = "",
o3 = "",
o4 = "",
o5 = "",
o6 = "",
o7 = "",
o8 = "",
o9 = "",
o10 = "")

Add column.

Parameters

o1..o7Named parameters.

Named Parameters

typeColumn data type.  See bellow list of types.
wWidth.
txtColumn caption.
txtmaxMax text lenght for EDITTEXT and EDITLONG types.
hdralHeader text alignment.  Number, LEFT=0, CENTER=1, RIGHT=2
hdrflagHeader flags.  If initially sorted set to initial sort direction.  ASC=0, DES=1, INVERT=2.
txtalColumn text alignment.
ilHandle of the image list.  For the image columns and combobox only.
formatFormat string for the EDITLONG, DATE and TIME types.
dataUser data.
hctrlHandle of the column editing control.  Used internally and with USER type.
itemsItems for the COMBOBOX column type.  Syntax suggar for ComboAddString function.

Types

EDITTEXT, EDITLONG, CHECKBOX, COMBOBOX, BUTTON, EDITBUTTON, HOTKEY, IMAGE, DATE, TIME, USER.

Returns

Column count.  0 on failure.

Remarks

Columns can not be added when the control has rows.  Total number of supported columns is around 3K.

AddRow

RG_AddRow(hGrd,  
Row = "",
c1 = "",
c2 = "",
c3 = "",
c4 = "",
c5 = "",
c6 = "",
c7 = "",
c8 = "",
c9 = "",
c10 = "")

Add row.

Parameters

RowRow number.  If 0 row is appended.  If omitted, blank row is added and cN are ignored if present.
if two numbers separated by space,r o - r is taken as row number, o as row offset.
c1..c10Column values.

Remarks

Maximum 65K rows are supported.

CellConvert

RG_CellConvert(hGrd,  
Col = "",
Row = "")

Convert cell.

ComboAddString

RG_ComboAddString(hGrd,
Col,
Items)

Populate combo box.

Parameters

ColColumn number.
Items”|” separated list of items.

ComboClear

RG_ComboClear(hGrd,
Col)

Clear combo box.

EnterEdit

RG_EnterEdit(hGrd,  
Col = "",
Row = "")

Edit cell.

Parameters

Col, RowCell coordinates.  If omitted, currently selected cell is used.

EndEdit

RG_EndEdit(hGrd,  
Col = "",
Row = "",
bCancel = 1)

End cell editing.

Parameters

Col, RowCell coordinates.  If omitted, currently selected cell is used.
bCancelSet to true to end editing.

DeleteRow

RG_DeleteRow(hGrd,  
Row = "")

Delete row.

Parameters

Row1 based row index.  Of omited, current row is deleted.

GetCell

RG_GetCell(hGrd,  
Col = "",
Row = "")

Get cell value.

GetCellRect

RG_GetCellRect( hGrd,  
 Col = "",
 Row = "",
ByRef Top = "",
ByRef Left = "",
ByRef Right = "",
ByRef Bottom = "")

Get cell rect.

GetColFormat

RG_GetColFormat(hGrd,  
Col = "")

Get column format.

GetColCount

RG_GetColCount(hGrd)

Returns number of columnns.

GetColWidth

RG_GetColWidth(hGrd,  
Col = "")

Get column width.

Parameters

ColColumn number.  Omit to get width for currently selected column.

GetColors

RG_GetColors( hGrd,  
 pQ,  
ByRef o1 = "",
ByRef o2 = "",
ByRef o3 = "")

Get colors.

Parameters

pQQuery parameter, string of color types to get.
o1..o3Reference to output variables.

Returns

o1.

GetColumn

RG_GetColumn( hGrd,  
 Col = "",
 pQ = "type",
ByRef o1 = "",
ByRef o2 = "",
ByRef o3 = "",
ByRef o4 = "",
ByRef o5 = "",
ByRef o6 = "",
ByRef o7 = "",
ByRef o8 = "",
ByRef o9 = "",
ByRef o10 = "")

Get column parameters.

Parameters

ColColumn number.  Omit to get current column.
pQQuery parameter.  Space separated list of named parameters: w txt hdral txtal type txtmax format il hdrflag hctrl data.  See AddColumn for details.  By default “type”.  Set “” to get all parameters.
o1..o10Reference to output variables.

Returns

o1

GetCurrentCell

RG_GetCurrentCell( hGrd,
ByRef Col,
ByRef Row)

Get current cell.

Parameters

Col, RowReference to variables to receive output.

GetCurrentCol

RG_GetCurrentCol(hGrd)

Get current column .

GetCurrentRow

RG_GetCurrentRow(hGrd)

Get currently selected row.

GetHdrHeight

RG_GetHdrHeight(hGrd)

Get height of the header row.

GetHdrText

RG_GetHdrText(hGrd,  
Col = "")

Get header text.

GetRowColor

RG_GetRowColor( hGrd,  
 Row = "",
ByRef B = "",
ByRef F = "")

Get row color.

Parameters

RowRow number.  If omitted current row will be used.
B,FBackground, foreground color.

GetRowHeight

RG_GetRowHeight(hGrd)

Get height of the row.

GetRowCount

RG_GetRowCount(hGrd)

Returns number of rows.

MoveRow

RG_MoveRow(hGrd,
From,
To)

Move row.

Parameters

FromNumber of the row to move.
ToNew position of the row.

ResetContent

RG_ResetContent(hGrd)

Reset content of the control.

ResetColumns

RG_ResetColumns(hGrd)

Reset columns of the control.

ScrollCell

RG_ScrollCell(hGrd)

Scrolls current cell into view.

SetCell

RG_SetCell(hGrd,  
Col = "",
Row = "",
Value = "")

Set cell value.

Parameters

Col,RowCell coordinates.  Omit to use current cell.
ValueCell value.  If omitted, empty string or 0 is used, depending on type.

SetColors

RG_SetColors(hGrd,
Colors)

Set colors.

Parameters

ColorsSpace separated string of the color types and values.  Possible types are B (background color), F (foreground color) and G (grid color).

SetColWidth

RG_SetColWidth(hGrd,  
Col = "",
Width = 0)

Set column width.

Parameters

ColColumn number.  Omit to get width for currently selected column.
WidthColumn width, by default 0.

SetColFormat

RG_SetColFormat(hGrd,  
Col = "",
Format = "")

Set column format.

SetCurrentRow

RG_SetCurrentRow(hGrd,
Row)

Set current row.

SetCurrentCol

RG_SetCurrentCol(hGrd,
Col)

Set current column.

SetCurrentCell

Set current cell.

Parameters

Col, RowCoordinates of the cell to select.

SetFont

RG_SetFont(hGrd,  
pFont = "")

Sets the control font.

Parameters

pFontAHK font definition: “Style, FontName”

SetHdrHeight

RG_SetHdrHeight(hGrd,  
Height = )

Set height of the header row.

Parameters

HeightHeader height.  By default 0.

SetHdrText

RG_SetHdrText(hGrd,  
Col = "",
Text = "")

Set header text.

SetRowColor

RG_SetRowColor(hGrd,  
Row = "",
B = "",
F = "")

Set row color.

Parameters

RowRow number.  If omitted current row will be used.
B,FBackground, foreground color, by default b/w.

SetRowHeight

RG_SetRowHeight(hGrd,
Height)

Set height of the row.

Sort

RG_Sort(hGrd,  
Col = "",
SortType = 3)

Sort column.

Parameters

ColColumn number.  Omit to get width for currently selected column.
SortTypeNumber, 1 (ASC), 2 (DES), 3 (INVERT).  By default, 3.

About

RG_Add(HParent,  
X,  
Y,  
W,  
H,  
Style = "",
Handler = "",
DllPath = "")
Create control.
RG_AddColumn(hGrd,  
o1 = "",
o2 = "",
o3 = "",
o4 = "",
o5 = "",
o6 = "",
o7 = "",
o8 = "",
o9 = "",
o10 = "")
Add column.
RG_AddRow(hGrd,  
Row = "",
c1 = "",
c2 = "",
c3 = "",
c4 = "",
c5 = "",
c6 = "",
c7 = "",
c8 = "",
c9 = "",
c10 = "")
Add row.
RG_CellConvert(hGrd,  
Col = "",
Row = "")
Convert cell.
RG_ComboAddString(hGrd,
Col,
Items)
Populate combo box.
RG_ComboClear(hGrd,
Col)
Clear combo box.
RG_EnterEdit(hGrd,  
Col = "",
Row = "")
Edit cell.
RG_EndEdit(hGrd,  
Col = "",
Row = "",
bCancel = 1)
End cell editing.
RG_DeleteRow(hGrd,  
Row = "")
Delete row.
RG_GetCell(hGrd,  
Col = "",
Row = "")
Get cell value.
RG_GetCellRect( hGrd,  
 Col = "",
 Row = "",
ByRef Top = "",
ByRef Left = "",
ByRef Right = "",
ByRef Bottom = "")
Get cell rect.
RG_GetColFormat(hGrd,  
Col = "")
Get column format.
RG_GetColCount(hGrd)
Returns number of columnns.
RG_GetColWidth(hGrd,  
Col = "")
Get column width.
RG_GetColors( hGrd,  
 pQ,  
ByRef o1 = "",
ByRef o2 = "",
ByRef o3 = "")
Get colors.
RG_GetColumn( hGrd,  
 Col = "",
 pQ = "type",
ByRef o1 = "",
ByRef o2 = "",
ByRef o3 = "",
ByRef o4 = "",
ByRef o5 = "",
ByRef o6 = "",
ByRef o7 = "",
ByRef o8 = "",
ByRef o9 = "",
ByRef o10 = "")
Get column parameters.
RG_GetCurrentCell( hGrd,
ByRef Col,
ByRef Row)
Get current cell.
RG_GetCurrentCol(hGrd)
Get current column .
RG_GetCurrentRow(hGrd)
Get currently selected row.
RG_GetHdrHeight(hGrd)
Get height of the header row.
RG_GetHdrText(hGrd,  
Col = "")
Get header text.
RG_GetRowColor( hGrd,  
 Row = "",
ByRef B = "",
ByRef F = "")
Get row color.
RG_GetRowHeight(hGrd)
Get height of the row.
RG_GetRowCount(hGrd)
Returns number of rows.
RG_MoveRow(hGrd,
From,
To)
Move row.
RG_ResetContent(hGrd)
Reset content of the control.
RG_ResetColumns(hGrd)
Reset columns of the control.
RG_ScrollCell(hGrd)
Scrolls current cell into view.
RG_SetCell(hGrd,  
Col = "",
Row = "",
Value = "")
Set cell value.
RG_SetColors(hGrd,
Colors)
Set colors.
RG_SetColWidth(hGrd,  
Col = "",
Width = 0)
Set column width.
RG_SetColFormat(hGrd,  
Col = "",
Format = "")
Set column format.
RG_SetCurrentRow(hGrd,
Row)
Set current row.
RG_SetCurrentCol(hGrd,
Col)
Set current column.
RG_SetFont(hGrd,  
pFont = "")
Sets the control font.
RG_SetHdrHeight(hGrd,  
Height = )
Set height of the header row.
RG_SetHdrText(hGrd,  
Col = "",
Text = "")
Set header text.
RG_SetRowColor(hGrd,  
Row = "",
B = "",
F = "")
Set row color.
RG_SetRowHeight(hGrd,
Height)
Set height of the row.
RG_Sort(hGrd,  
Col = "",
SortType = 3)
Sort column.
Close