A wxformgrid object is an area of a form where a table with rows and columns, row labels and column labels are displayed. The grid can be larger than the visible area.
| Property | Type | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| _ | type(*) | This property is provided for use by the user to attach any object of any type to the type in which this property is provided. | ||||||||||
| __ | type(*) | This property is provided for use by the user to attach any object of any type to the type in which this property is provided. It has the additional feature of being marked with the resolve keyword, so that object resolution can continue down this property. | ||||||||||
| alignment | string | Specifies the default alignment for the cells. | ||||||||||
| captureable | boolean |
Specifies whether or not the control events can be captured by the
form when the controlcapture() method is
called.
| ||||||||||
| colcount | integer | Specifies the number of columns in the grid. | ||||||||||
| collabelalignment | string | Specifies the alignment for the column labels. | ||||||||||
| collabelheight | integer | Specifies the height of the column label row in pixels. | ||||||||||
| colwidthdraggable | boolean | Specifies whether the column width can be changed by the user. | ||||||||||
| enabled | boolean | Specifies whether or not the control is enabled. | ||||||||||
| focusable | boolean |
Specifies whether or not the control can have the input focus. For
wxformedittext objects this is always
.true.
| ||||||||||
| font | wxfont | This the default font for the cells. | ||||||||||
| form | wxform | Specifies the wxform object to which this edit control belongs. | ||||||||||
| height | integer | Gives the height of the grid control, in pixels. | ||||||||||
| labelfont | wxfont | This the font used for the labels. | ||||||||||
| left | integer | Gives the position of the left side of the grid control relative to the left side of the form, in pixels. | ||||||||||
| name | string | The name of the wxformgrid object. | ||||||||||
| next | type(wxformcontrol) |
Specifies the next wxformcontrol on the same
form.
| ||||||||||
| oncellchange | event | An event that is triggered when the user changes the content of a cell. The event handling function will receive the following parameters: (wxformgrid me, integer row, integer col[, type(*) reference]) the reference is only passed if it is provided by the user. | ||||||||||
| oncellselect | event | An event that is triggered when the user selects a cell. The event handling function will receive the following parameters: (wxformgrid me, integer row, integer col[, type(*) reference]) the reference is only passed if it is provided by the user. | ||||||||||
| oncolwidthchange | event | An event that is triggered when the user resizes a column. The event handling function will receive the following parameters: (wxformgrid me, integer col[, type(*) reference]). The reference is only passed if it is provided by the user. | ||||||||||
| ongotfocus | event | An event that is triggered when the grid control receives input focus. The event handling function will receive the following parameters: (wxformgrid me[, type(*) reference]) the reference is only passed if it is provided by the user. | ||||||||||
| onlostfocus | event | An event that is triggered when the grid control loses input focus. The event handling function will receive the following parameters: (wxformgrid me[, type(*) reference]). The reference is only passed if it is provided by the user. | ||||||||||
| onmouse | event |
An event that is triggered each time a mouse event occurs that
matches the bits set in the onmousemask
property. The onmouse event handling function should be defined as
follows:
| ||||||||||
| onmousemask | integer | Holds the mask that decides which mouse events are captured and sent to the onmouse event handler. | ||||||||||
| onrowheightchange | event | An event that is triggered when the user resizes a row. The event handling function will receive the following parameters: (wxformgrid me, integer row[, type(*) reference]). The reference is only passed if it is provided by the user. | ||||||||||
| rowcount | integer | Specifies the number of rows in the grid. | ||||||||||
| rowheightdraggable | boolean | Specifies whether the row height can be changed by the user. | ||||||||||
| rowlabelalignment | string | Specifies the alignment for the row labels. | ||||||||||
| rowlabelwidth | integer | Specifies the width of the row label column in pixels. | ||||||||||
| tooltip | string | Contains the test that is displayed as a tooltip for the control. | ||||||||||
| top | integer | Gives the position of the top edge of the grid control relative to the top edge of the form, in pixels. | ||||||||||
| type | type | Specifies the wxformgrid type object. | ||||||||||
| visible | boolean | Specifies whether or not the control is visible. | ||||||||||
| width | integer | Gives the width of the grid control, in pixels. |
Retrieves the current alignment for the desired cell as a string in the form described for setting the alignment.
Retrieves the value of the choice for the desired cell and index
value or .nul if the cell is not a choice cell or
if the index value is too large.
Retrieves .true if the desired cell allows other
entries than the ones from its list of choices,
.false if it does not, or .nul
if the cell is not a choice cell.
Retrieves the number of choices for the desired cell or
.nul if the cell is not a choice cell.
Retrieves the current font for the desired cell as a
wxfont object, or .nul if no font is
assigned to the cell or as the default for the grid.
Removes the control from the form. If any object has a reference to the control, those references will no longer be valid. It is not safe to attempt to use a control after this method has been called.
This method assigns the alignments for the row and column labels and
the default cell alignment. The wxformgrid object itself
is returned, to allow multiple methods to be put into one expression.
The alignment is for both horizontal and vertical alignment. The
string can be made up of two comma separated string values. The valid
values are: left, right,
top, and bottom. Providing two
values for the same vector of alignment is an error, such as
"left,right". If an element is not supplied, it is
assumed to be middle (in either direction). Supplying an empty string
would create an alignment both horizontally and vertically centered.
wxformgridvar.setalignments (
string ,
string rowlabelalignment,
string collabelalignment )
alignment
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| rowlabelalignment | The current setting of the rowlabelalignment property | string | The alignment string for both horizontal and vertical alignment for row labels. |
| collabelalignment | The current setting of the collabelalignment property | string | The alignment string for both horizontal and vertical alignment for column labels. |
| alignment | The current setting for default alignment for cells that have no specifically defined alignment. | string | The default alignment string for both horizontal and vertical alignment for cells. |
This method is used to determine whether the events for the control can be captured and passed to the form or not. By default, events can be captured.
Sets the alignment for the cell or cells (if used with a range). The wxformgrid object itself is returned, to allow multiple methods to be put into one expression. It is not possible to set a cell back to being controlled by the default grid alignment setting. This limitation is part of the underlying grid control used for the implementation.
wxformgridvar.setcellalignment (
integer ,
integer row,
string col,
integer alignment,
integer startrow,
integer endrow,
integer startcol )
endcol
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| row | None | integer |
The row in which the cell is found. If not specified, then the
startrow and endrow
parameters are used.
|
| col | None | integer |
The column in which the cell is found. If not specified, then
the startcol and
endcol parameters are used.
|
| alignment | The current cell alignment if already assigned else the default alignment | string |
The alignment to be assigned to the cell. The alignment is for
both horizontal and vertical alignment. The string can be made up
of two comma separated string values. The valid values are:
left, right,
top, and bottom. Providing
two values for the same vector of alignment is an error, such as
"left,right". If an element is not supplied,
it is assumed to be middle (in either direction). Supplying an
empty string would create an alignment both horizontally and
vertically centered.
|
| startrow | 1 | integer | The starting row of a range for which to assign the alignment. |
| endrow | Number of rows in the grid | integer | The ending row of a range for which to assign the alignment. |
| startcol | 1 | integer | The starting column of a range for which to assign the alignment. |
| endcol | Number of columns in the grid | integer | The ending column of a range for which to assign the alignment. |
Sets the currently selected value plus the list of choices for the
desired cell or range. The choices are not named parameters, they are
simply listed as separate string parameters for as many as there are
choices. The wxformgrid object itself is returned, to
allow multiple methods to be put into one expression. Calling this
method with no choices values and the
allowothers parameter set to
.true will set the cell back to being a normal
string cell. Calling this method with no choices values and the
allowothers parameter set to
.false will result in an error. To set or get a
choice (or other value if allowed) for a choice cell using the
setcellvalue() and
getcellvalue() methods.
![]() | Note |
|---|---|
Any
unnamed parameter used when calling this method will be considered to
be a choice! It is essential that the
|
wxformgridvar.setcellchoices (
integer ,
integer row,
string col,
boolean value,
integer allowothers,
integer startrow,
integer endrow,
integer startcol,
string endcol,
string choices,
)
…
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| row | None | integer |
The row in which the cell is found. If not specified, then the
startrow and endrow
parameters are used.
|
| col | None | integer |
The column in which the cell is found. If not specified, then
the startcol and
endcol parameters are used.
|
| value | The existing value in the cell | string | The value to be assigned to the cell. |
| allowothers | .true | boolean |
If this value is .true then the combo box
will be a dropedit style, if it is .false then
it will be a droplist style.
|
| startrow | 1 | integer | The starting row of a range for which to assign the value. |
| endrow | Number of rows in the grid | integer | The ending row of a range for which to assign the value. |
| startcol | 1 | integer | The starting column of a range for which to assign the value. |
| endcol | Number of columns in the grid | integer | The ending column of a range for which to assign the value. |
| choices | None | string | This string parameter can be used to set the choices by placing them into the string separated by the character value 0 ("{0}"). This allows programmatic/dynamic creation of the list of choices (for example by reading records from a database and creating the string dynamically). |
| None | string | The string to be added as a choice. | |
| … | None |
Sets the font to be used for the cell or cells (if using a range) in the grid control. The wxformgrid object itself is returned, to allow multiple setting methods to be put into one expression.
wxformgridvar.setcellfont (
integer ,
integer row,
wxfont col,
integer font,
integer startrow,
integer endrow,
integer startcol )
endcol
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| row | None | integer |
The row in which the cell is found. If not specified, then the
startrow and endrow
parameters are used.
|
| col | None | integer |
The column in which the cell is found. If not specified, then
the startcol and
endcol parameters are used.
|
| font | None | wxfont | The wxfont object that will be used to format the text in the cell(s). |
| startrow | 1 | integer | The starting row of a range for which to assign the font. |
| endrow | Number of rows in the grid | integer | The ending row of a range for which to assign the font. |
| startcol | 1 | integer | The starting column of a range for which to assign the font. |
| endcol | Number of columns in the grid | integer | The ending column of a range for which to assign the font. |
Sets the desired cell or range to read only. The wxformgrid object itself is returned, to allow multiple methods to be put into one expression. Calling this method with no parameters will clear all values from the grid.
wxformgridvar.setcellreadonly (
integer ,
integer row,
boolean col,
integer readonly,
integer startrow,
integer endrow,
integer startcol )
endcol
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| row | None | integer |
The row in which the cell is found. If not specified, then the
startrow and endrow
parameters are used.
|
| col | None | integer |
The column in which the cell is found. If not specified, then
the startcol and
endcol parameters are used.
|
| readonly | .true | boolean | Whether the cell will be set to read only or not. |
| startrow | 1 | integer | The starting row of a range for which to set cells to read only. |
| endrow | Number of rows in the grid | integer | The ending row of a range for which to set cells to read only. |
| startcol | 1 | integer | The starting column of a range for which to set cells to read only. |
| endcol | Number of columns in the grid | integer | The ending column of a range for which to set cells to read only. |
Sets the value for the desired cell or range. The wxformgrid object itself is returned, to allow multiple methods to be put into one expression. Calling this method with no parameters will clear all values from the grid.
wxformgridvar.setcellvalue (
integer ,
integer row,
string col,
array value,
integer valuearray,
integer startrow,
integer endrow,
integer startcol )
endcol
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| row | None | integer |
The row in which the cell is found. If not specified, then the
startrow and endrow
parameters are used.
|
| col | None | integer |
The column in which the cell is found. If not specified, then
the startcol and
endcol parameters are used.
|
| value | None | string | The value to be assigned to the cell. |
| valuearray | None | array |
This is an array of values to be assigned to multiple cells. The
array is structured as follows: a[row,col], so to assign a group
of values in one operation, for each row an array element is
assigned the corresponding string value for each column. The row
number is not a relative offset, it and the column number should
directly reflect the position in the grid itself. Use the
startrow, endrow,
startcol, and
endcol parameters to restrict the updates
to only a certain range.
|
| startrow | 1 | integer | The starting row of a range for which to assign the value. |
| endrow | Number of rows in the grid | integer | The ending row of a range for which to assign the value. |
| startcol | 1 | integer | The starting column of a range for which to assign the value. |
| endcol | Number of columns in the grid | integer | The ending column of a range for which to assign the value. |
Sets the height of the column labels. By setting this to 1, the column labels can be hidden. The wxformgrid object itself is returned, to allow multiple methods to be put into one expression.
Assigns labels to the columns in a grid control. The starting column is used to determine where the assignments begin. Multiple labels can be assigned in one call and each one will follow the next sequentially. The wxformgrid object itself is returned, to allow multiple methods to be put into one expression.
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| startcol | 1 | integer | The column to which to assign the first of the labels. The remaining strings (if any) will be assigned sequentially following the first one. |
| None | string |
The string to be assigned to the label at the position described
by the startcol.
| |
| … | None |
Sets the width of the designated column or columns. If the
col parameter is specified, then the
startcol and endcol
parameters cannot be specified and only one width value can be
specified, either named or unnamed. If the
colwidth parameter is specified, then no
unnamed parameters can be used. The wxformgrid object
itself is returned, to allow multiple methods to be put into one
expression.
wxformgridvar.setcolwidths (
integer ,
integer col,
integer colwidth,
integer startcol,
integer endcol,
)
…
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| col | None | integer | The column to which to apply the width value. |
| colwidth | The initial width for all columns | integer | The width of the specified column. |
| startcol | 1 | integer | The starting column to which to apply the width value(s). |
| endcol | Number of columns in the grid | integer | The starting column to which to apply the width value(s). |
| None | integer | The width in pixels of the first column in sequence. | |
| … | None |
Determines whether the row heights and/or column widths can be modified by the user. The wxformgrid object itself is returned, to allow multiple methods to be put into one expression.
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| rowheightdraggable | The current setting of the rowheightdraggable property | boolean |
If this is set to .true, then the heights of
the rows can be modified by the user.
|
| colwidthdraggable | The current setting of the colwidthdraggable property | boolean |
If this is set to .true, then the widths of
the columns can be modified by the user.
|
Sets the enabled state of the grid control. The wxformgrid object itself is returned, to allow multiple setting methods to be put into one expression.
Sets focus to the control, provided that it is not invisible or disabled. If this is called for a form that is not yet in a container, then nothing will happen except that the focuscontrol of the wxform object will be set. Once the form is placed in a container, the control will get focus and the ongotfocus event will fire.
Sets the default font to be used for the text in the grid control. The wxformgrid object itself is returned, to allow multiple setting methods to be put into one expression.
Sets the font to be used for the row and column labels in the grid control. The wxformgrid object itself is returned, to allow multiple setting methods to be put into one expression.
Sets the name of the grid control. The wxformgrid object itself is returned, to allow multiple setting methods to be put into one expression.
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| next | None | type(wxformcontrol) |
Calling the method with the value .nul sets a
control to be the last one in the ring (the one before
form.firstcontrol) and so has the highest z-order, and passing
any other control as the argument puts the target control
immediately below the one specified as the parameter. The visible
stacking of controls on a form is such that the earliest in the
ring is the furthest back in the z-order.
|
Sets the mask that is used to decide which mouse events will be trapped for the control. The wxformgrid object itself is returned, to allow multiple setting methods to be put into one expression.
| Parameter | Default value | Type name | Description | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| onmousemask | None | integer |
The definition of which events should be handled by the
onmouse event handler. The
|
Sets the size and/or position of the grid control. The wxformgrid object itself is returned, to allow multiple setting methods to be put into one expression.
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| left | The current value of the left
property | integer | The new position of the left side of the grid control on the form. |
| top | The current value of the top
property | integer | The new position of the top edge of the grid control on the form. |
| width | The current value of the width
property | integer | The new width of the grid control on the form. |
| height | The current value of the height
property | integer | The new height of the grid control on the form. |
Sets the height of the designated row or rows. If the
row parameter is specified, then the
startrow and endrow
parameters cannot be specified and only one height value can be
specified, either named or unnamed. If the
rowheight parameter is specified, then no
unnamed parameters can be used. The wxformgrid object
itself is returned, to allow multiple methods to be put into one
expression.
wxformgridvar.setrowheights (
integer ,
integer row,
integer rowheight,
integer startrow,
integer endrow )
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| row | None | integer | The row to which to apply the height value. |
| rowheight | The initial height for all rows | integer | The height of the specified row. |
| startrow | 1 | integer | The starting row to which to apply the height value(s). |
| endrow | Number of rows in the grid | integer | The starting row to which to apply the height value(s). |
| None | integer | The height in pixels of the first row in sequence. |
Assigns labels to the rows in a grid control. The starting row is used to determine where the assignments begin. Multiple labels can be assigned in one call and each one will follow the next sequentially. The wxformgrid object itself is returned, to allow multiple methods to be put into one expression.
| Parameter | Default value | Type name | Description |
|---|---|---|---|
| startrow | 1 | integer | The row to which to assign the first of the labels. The remaining strings (if any) will be assigned sequentially following the first one. |
| None | string |
The string to be assigned to the label at the position described
by the startrow.
| |
| … | None |
Sets the width of the row labels. By setting this to 1, the row labels can be hidden. The wxformgrid object itself is returned, to allow multiple methods to be put into one expression.
Sets the text for the tooltip associated with the control. The wxformgrid object itself is returned, to allow multiple setting methods to be put into one expression.
Sets the visibility of the grid control. The wxformgrid object itself is returned, to allow multiple setting methods to be put into one expression.


![[Note]](images/note.png)

