Advanced grid custom control.
(See RaGrid.png)
RaGrid | Advanced grid custom control. |
Add | Create control. |
AddColumn | Add column. |
AddRow | Add row. |
CellConvert | Convert cell. |
ComboAddString | Populate combo box. |
ComboClear | Clear combo box. |
EnterEdit | Edit cell. |
EndEdit | End cell editing. |
DeleteRow | Delete row. |
GetCell | Get cell value. |
GetCellRect | Get cell rect. |
GetColFormat | Get column format. |
GetColCount | Returns number of columnns. |
GetColWidth | Get column width. |
GetColors | Get colors. |
GetColumn | Get column parameters. |
GetCurrentCell | Get current cell. |
GetCurrentCol | Get current column . |
GetCurrentRow | Get currently selected row. |
GetHdrHeight | Get height of the header row. |
GetHdrText | Get header text. |
GetRowColor | Get row color. |
GetRowHeight | Get height of the row. |
GetRowCount | Returns number of rows. |
MoveRow | Move row. |
ResetContent | Reset content of the control. |
ResetColumns | Reset columns of the control. |
ScrollCell | Scrolls current cell into view. |
SetCell | Set cell value. |
SetColors | Set colors. |
SetColWidth | Set column width. |
SetColFormat | Set column format. |
SetCurrentRow | Set current row. |
SetCurrentCol | Set current column. |
SetCurrentCell | Set current cell. |
SetFont | Sets the control font. |
SetHdrHeight | Set height of the header row. |
SetHdrText | Set header text. |
SetRowColor | Set row color. |
SetRowHeight | Set height of the row. |
Sort | Sort column. |
Examples | |
About |
RG_Add( HParent, X, Y, W, H, Style = "", Handler = "", DllPath = "" )
Create control.
X..H | Position of the control. |
Style | Space separated list of control styles, by default both scroll bars are visible. You can use numbers or style strings. |
Handler | Notification events handler. |
DllPath | Path of the control dll, by default control is searched in the current folder. |
NOSEL, NOFOCUS, HGRIDLINES, VGRIDLINES, GRIDLINES, GRIDFRAME, NOCOLSIZE.
Result := Handler(HCtrl, Event, Col, Row, Data )
HCtrl | Control sending the event. |
Event | Specifies event that occurred. Event must be registered to be able to monitor it. |
Col,Row | Cell coordinates. |
Data | Numeric data of the cell. Pointer to string for textual cells and DWORD value for numeric. |
Result | Return 1 to prevent some actions. |
Headerclick | Sent when user clicks header. |
Buttonclick | Sent when user clicks the button in a button cell. |
Checkclick | Sent when user double clicks the checkbox in a checkbox cell. |
Imageclick | Sent when user double clicks the image in an image cell. |
Beforeselchange | Sent when user request a selection change. |
Afterselchange | Sent after a selection change. |
Beforeedit | Sent before the cell edit control shows. |
Afteredit | Sent when the cell edit control is about to close. |
Beforeupdate | Sent before a cell updates grid data. |
Afterupdate | Sent after grid data has been updated. |
Userconvert | Sent when user cell needs to be converted. |
Control’s handle.
RG_AddColumn( hGrd, o1 = "", o2 = "", o3 = "", o4 = "", o5 = "", o6 = "", o7 = "", o8 = "", o9 = "", o10 = "" )
Add column.
o1..o7 | Named parameters. |
type | Column data type. See bellow list of types. |
w | Width. |
txt | Column caption. |
txtmax | Max text lenght for EDITTEXT and EDITLONG types. |
hdral | Header text alignment. Number, LEFT=0, CENTER=1, RIGHT=2 |
hdrflag | Header flags. If initially sorted set to initial sort direction. ASC=0, DES=1, INVERT=2. |
txtal | Column text alignment. |
il | Handle of the image list. For the image columns and combobox only. |
format | Format string for the EDITLONG, DATE and TIME types. |
data | User data. |
hctrl | Handle of the column editing control. Used internally and with USER type. |
items | Items for the COMBOBOX column type. Syntax suggar for ComboAddString function. |
EDITTEXT, EDITLONG, CHECKBOX, COMBOBOX, BUTTON, EDITBUTTON, HOTKEY, IMAGE, DATE, TIME, USER.
Column count. 0 on failure.
Columns can not be added when the control has rows. Total number of supported columns is around 3K.
RG_AddRow( hGrd, Row = "", c1 = "", c2 = "", c3 = "", c4 = "", c5 = "", c6 = "", c7 = "", c8 = "", c9 = "", c10 = "" )
Add row.
Row | Row 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..c10 | Column values. |
Maximum 65K rows are supported.
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.
Col | Column number. Omit to get current column. |
pQ | Query 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..o10 | Reference to output variables. |
o1
SetBatchLines, -1 w := 350, h := 400 Gui, +LastFound +Resize hwnd := WinExist() hGrd := RG_Add(hwnd, 0, 0, w, h, "NOSEL", "OnRa" ) RG_SetHdrHeight(hGrd, 25), RG_SetRowHeight(hGrd, 26) loop, 3 RG_AddColumn(hGrd, "txt=Column " A_Index, "type=EditText") loop, 9 RG_AddRow(hGrd, 0, "1." A_Index, "2." A_Index ,"3." A_Index) Gui, Show, h%h% w%w% return OnRa(HCtrl, Event, Col, Row, Data="") { if (Event = "BeforeEdit") && (Col != 3) return 1 ;return 1 to prevent editing of all columns except 3thd one. }
Create control.
RG_Add( HParent, X, Y, W, H, Style = "", Handler = "", DllPath = "" )
Add column.
RG_AddColumn( hGrd, o1 = "", o2 = "", o3 = "", o4 = "", o5 = "", o6 = "", o7 = "", o8 = "", o9 = "", o10 = "" )
Add row.
RG_AddRow( hGrd, Row = "", c1 = "", c2 = "", c3 = "", c4 = "", c5 = "", c6 = "", c7 = "", c8 = "", c9 = "", c10 = "" )
Convert cell.
RG_CellConvert( hGrd, Col = "", Row = "" )
Populate combo box.
RG_ComboAddString( hGrd, Col, Items )
Clear combo box.
RG_ComboClear( hGrd, Col )
Edit cell.
RG_EnterEdit( hGrd, Col = "", Row = "" )
End cell editing.
RG_EndEdit( hGrd, Col = "", Row = "", bCancel = 1 )
Delete row.
RG_DeleteRow( hGrd, Row = "" )
Get cell value.
RG_GetCell( hGrd, Col = "", Row = "" )
Get cell rect.
RG_GetCellRect( hGrd, Col = "", Row = "", ByRef Top = "", ByRef Left = "", ByRef Right = "", ByRef Bottom = "" )
Get column format.
RG_GetColFormat( hGrd, Col = "" )
Returns number of columnns.
RG_GetColCount( hGrd )
Get column width.
RG_GetColWidth( hGrd, Col = "" )
Get colors.
RG_GetColors( hGrd, pQ, ByRef o1 = "", ByRef o2 = "", ByRef o3 = "" )
Get column parameters.
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 current cell.
RG_GetCurrentCell( hGrd, ByRef Col, ByRef Row )
Get current column .
RG_GetCurrentCol( hGrd )
Get currently selected row.
RG_GetCurrentRow( hGrd )
Get height of the header row.
RG_GetHdrHeight( hGrd )
Get header text.
RG_GetHdrText( hGrd, Col = "" )
Get row color.
RG_GetRowColor( hGrd, Row = "", ByRef B = "", ByRef F = "" )
Get height of the row.
RG_GetRowHeight( hGrd )
Returns number of rows.
RG_GetRowCount( hGrd )
Move row.
RG_MoveRow( hGrd, From, To )
Reset content of the control.
RG_ResetContent( hGrd )
Reset columns of the control.
RG_ResetColumns( hGrd )
Scrolls current cell into view.
RG_ScrollCell( hGrd )
Set cell value.
RG_SetCell( hGrd, Col = "", Row = "", Value = "" )
Set colors.
RG_SetColors( hGrd, Colors )
Set column width.
RG_SetColWidth( hGrd, Col = "", Width = 0 )
Set column format.
RG_SetColFormat( hGrd, Col = "", Format = "" )
Set current row.
RG_SetCurrentRow( hGrd, Row )
Set current column.
RG_SetCurrentCol( hGrd, Col )
Sets the control font.
RG_SetFont( hGrd, pFont = "" )
Set height of the header row.
RG_SetHdrHeight( hGrd, Height = )
Set header text.
RG_SetHdrText( hGrd, Col = "", Text = "" )
Set row color.
RG_SetRowColor( hGrd, Row = "", B = "", F = "" )
Set height of the row.
RG_SetRowHeight( hGrd, Height )
Sort column.
RG_Sort( hGrd, Col = "", SortType = 3 )