SalTableWindowBase
Namespace: PPJ.Runtime.Windows
Assembly: PPJ.Web.50 (5.0.0.0)
Provides the main and split grids, SAL row-context translation, and column infrastructure for table controls.
- C#
- VB.NET
public class SalTableWindowBase : UserControl
Public Class SalTableWindowBase
Inherits UserControl
Example:
SalTableWindow table = new SalTableWindow();
SalTableWindowBase gridHost = table;
gridHost.AllowSorting = true;
gridHost.RowHeaderWidth = 32;
Properties
ActiveColumn
SalTableColumn: Gets the SAL column associated with the current cell, or null when there is no current cell.
AllowSorting
Boolean: Gets or sets whether main-grid columns sort automatically when their headers are clicked. (Default: False)
AutoScroll
Boolean: Gets false; container automatic scrolling assignments are ignored because the grids manage scrolling. (Default: False)
AutoScrollMargin
Size: Gets an empty size; container scroll-margin assignments are ignored.
AutoScrollMinSize
Size: Gets an empty size; container minimum-scroll-size assignments are ignored.
AutoSize
Boolean: Gets false. Assignments are ignored because this table does not support automatic sizing. (Default: False)
AutoSizeMode
AutoSizeMode: Gets GrowAndShrink. Assignments are ignored.
BackgroundImage
Image: Gets null; background image assignments are ignored. (Default: null)
BackgroundImageSource
String: Gets null. Assignments are ignored because this table does not support a background image source. (Default: null)
Columns
SalTableColumnCollection: Gets the SAL column collection, creating its wrapper on first access.
ContextRow
Int32: Gets or requests a change to the SAL row context used for column-value access.
CurrentColumn
Int32: Gets the zero-based column index captured when the row context was set.
CurrentGrid
DataGridView: Gets the grid selected by the current SAL row context.
CurrentRow
Int32: Gets the stored current row index used by table navigation.
DefaultRowHeight
Int32: Gets or sets the default row height in pixels for the main grid.
DisableSplitGrid
Boolean: Gets or sets whether the split grid rejects focus and row or cell selection. (Default: False)
FocusRow
Int32: Gets the SAL row context of the current row, or selects the header cell of a valid specified row.
IsEmbedded
Boolean: Gets whether this table is hosted within another table window. The base implementation returns false.
KeyPreview
Boolean: Gets false. Assignments are ignored.
MainGrid
DataGridView: Gets the grid containing ordinary table rows.
RowHeaderFlags
Int32: Gets or replaces the row-header flags and refreshes their display.
RowHeaderImages
ArrayList: Gets the mutable collection of custom row-header images, creating it on first access.
RowHeaderTitle
String: Gets or sets the text in the main grid’s upper-left header cell.
RowHeaderWidth
Int32: Gets or sets the row-header width in pixels for both grids.
Rows
SalTableRowCollection: Gets a new live view of the main grid data rows, excluding fixed headers.
ScrollBars
ScrollBars: Gets Both. Assignments are ignored; the internal grids manage their scroll bars.
SplitGrid
DataGridView: Gets the grid containing split rows, or null when no split grid exists.
SplitGridRows
Int32: Gets the configured number of visible rows in the split grid.
SplitRows
SalTableRowCollection: Gets a new live view of secondary-grid data rows, or null when no secondary grid exists.
Splitter
SplitContainer: Gets the split container used to arrange the main and split grids.
TableFlags
Int32: Gets or replaces the SAL table flags and applies all supported table-style effects.
Methods
BeginUpdate()
Suspends updates to the main grid until EndUpdate is called.
CanEditCell(cell)
Checks whether a cell belongs to a visible, writable row and an enabled SAL column.
| Parameter | Type | Description |
|---|---|---|
| cell | DataGridViewCell | The cell to inspect, or null. |
Returns: Boolean. True if the cell is non-null and its grid, row, and column permit editing.
CanEditCell(grid, row, col)
Checks grid, row, and column restrictions before allowing cell editing.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The grid containing the cell. |
| row | Int32 | The zero-based row index. |
| col | Int32 | The zero-based column index. |
Returns: Boolean. True if the indices are valid, the grid is writable, the row and column are visible and writable, and the associated SAL column is enabled.
CanMoveCell()
Attempts to finish editing the current grid cell before navigation.
Returns: Boolean. True if editing can finish; otherwise, false.
ClearSelectedColumns()
Clears selected columns in both grids while suppressing selection messages.
ClearSelectedRows()
Clears selected rows in both grids while suppressing selection messages.
CreateDataGridColumn(column, splitTable)
Creates a grid column matching the SAL column’s cell type and this table’s sorting mode.
| Parameter | Type | Description |
|---|---|---|
| column | SalTableColumn | The SAL column whose cell type selects the grid column implementation. |
| splitTable | Boolean | Reserved for split-grid specialization; the base implementation ignores this value. |
Returns: DataGridViewColumn. A new, unattached grid column.
Throws:
- ArgumentNullException column is null.
CreateMainGrid()
Creates the main grid owned by this table.
Returns: DataGridViewEx. A new DataGridViewEx associated with this table.
CreateSplitGrid()
Creates the split grid owned by this table.
Returns: DataGridViewEx. A new DataGridViewEx associated with this table.
CreateSplitGrid(visibleRows, resizable)
Creates and displays the split grid, cloning the main-grid columns when first created.
| Parameter | Type | Description |
|---|---|---|
| visibleRows | Int32 | The positive number of rows used to determine the initial split-grid height. |
| resizable | Boolean | True to let the user move the splitter; false to fix its position. |
Calling this method for an existing split grid updates resizing and layout without reinitializing its height. Horizontal scrolling moves to the split grid. Throws:
- ArgumentOutOfRangeException visibleRows is less than one.
DestroySplitGrid()
Disposes the split grid, detaches split columns, and restores the main grid’s scroll bars and layout.
EndUpdate()
Resumes updates to the main grid after BeginUpdate.
FinishEditing(grid, cancel)
Ends the current cell edit when the specified grid is editing.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The grid whose edit is ended. |
| cancel | Boolean | Reserved for compatibility; this implementation ignores it and calls EndEdit. |
Returns: Boolean. The result of EndEdit, or true when no cell is being edited.
GetCellStyle(column, row)
Gets the mutable style of a cell in the resolved main or split row.
| Parameter | Type | Description |
|---|---|---|
| column | SalTableColumn | The SAL column identifying the cell. |
| row | Int32 | The SAL row context. |
Returns: DataGridViewCellStyle. The cell style, or null if the row context, SAL column, or main-grid column is unavailable.
GetCellStyleNew(column, row)
Gets the mutable style of a cell in the resolved main or split row.
| Parameter | Type | Description |
|---|---|---|
| column | SalTableColumn | The SAL column identifying the cell. |
| row | Int32 | The SAL row context. |
Returns: DataGridViewCellStyle. The cell style, or null if the row context, SAL column, or main-grid column is unavailable.
GetCellValue(cell)
Converts a cell’s value to text.
| Parameter | Type | Description |
|---|---|---|
| cell | DataGridViewCell | The cell to inspect. |
Returns: String. The value’s string representation, or an empty string for a null value.
GetColHeaderStyle(column)
Gets the mutable style of the main-grid column’s header cell.
| Parameter | Type | Description |
|---|---|---|
| column | SalTableColumn | The SAL column to inspect. |
Returns: DataGridViewCellStyle. The header style, or null if the column or its main-grid column is unavailable.
GetColHeaderStyleNew(column)
Gets the mutable style of the main-grid column’s header cell.
| Parameter | Type | Description |
|---|---|---|
| column | SalTableColumn | The SAL column to inspect. |
Returns: DataGridViewCellStyle. The header style, or null if the column or its main-grid column is unavailable.
GetCols(grid)
Gets the specified grid’s column collection.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The grid to inspect. |
Returns: DataGridViewColumnCollection. The grid’s live column collection.
GetColStyle(column)
Gets the mutable default cell style of the main-grid column.
| Parameter | Type | Description |
|---|---|---|
| column | SalTableColumn | The SAL column to inspect. |
Returns: DataGridViewCellStyle. The column style, or null if the column or its main-grid column is unavailable.
GetColStyleNew(column)
Gets the mutable default cell style of the main-grid column. The same style is also assigned to its split-grid column.
| Parameter | Type | Description |
|---|---|---|
| column | SalTableColumn | The SAL column to inspect. |
Returns: DataGridViewCellStyle. The column style, or null if the column or its main-grid column is unavailable.
GetContextRowFromCode(rowCode)
Expands a special SAL row code into its iteration boundary or row context.
| Parameter | Type | Description |
|---|---|---|
| rowCode | Int32 | The row context or TBL_* row code. |
Returns: Int32. The expanded context, or the original value for an ordinary row context.
TBL_MaxRow expands to the main row count, one past the last row. TBL_MinRow expands to the boundary preceding split rows, or -1 without a split grid. TBL_TempRow and TBL_Error map to -1; the result is not necessarily an existing row.
GetCurrentCol(grid)
Gets the column index of the specified grid’s current cell.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The grid to inspect. |
Returns: Int32. The zero-based column index, or -1 when no current cell exists.
GetCurrentRow(grid)
Gets the row index of the specified grid’s current cell.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The grid to inspect. |
Returns: Int32. The zero-based row index, or -1 when no current cell exists.
GetRowHeaderStyle(row)
Gets the mutable style of a row’s header cell.
| Parameter | Type | Description |
|---|---|---|
| row | Int32 | The SAL row context. |
Returns: DataGridViewCellStyle. The header style, or null when the row context is invalid.
GetRowHeaderStyleNew(row)
Gets the mutable style of a row’s header cell.
| Parameter | Type | Description |
|---|---|---|
| row | Int32 | The SAL row context. |
Returns: DataGridViewCellStyle. The header style, or null when the row context is invalid.
GetRows(grid)
Gets the specified grid’s row collection.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The grid to inspect. |
Returns: DataGridViewRowCollection. The grid’s live row collection.
GetRowStyle(row)
Gets the mutable default cell style of a table row.
| Parameter | Type | Description |
|---|---|---|
| row | Int32 | The SAL row context. |
Returns: DataGridViewCellStyle. The row’s style, or null when the row context is invalid.
GetRowStyleNew(row)
Gets the mutable default cell style of a table row.
| Parameter | Type | Description |
|---|---|---|
| row | Int32 | The SAL row context. |
Returns: DataGridViewCellStyle. The row’s style, or null when the row context is invalid.
IsValidCol(cell)
Checks whether a cell identifies an existing grid column.
| Parameter | Type | Description |
|---|---|---|
| cell | DataGridViewCell | The cell to inspect, or null. |
Returns: Boolean. True if the cell is non-null, the table is not disposed, and the column index is in range.
IsValidCol(grid, col)
Checks whether a column index exists in the specified grid.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The grid containing the column. |
| col | Int32 | The zero-based column index. |
Returns: Boolean. True if the table is not disposed and the column index is in range.
IsValidContextRow(rowNum)
Checks whether a SAL row context resolves to an existing main-grid or split-grid row.
| Parameter | Type | Description |
|---|---|---|
| rowNum | Int32 | The SAL row context to resolve. |
Returns: Boolean. True if the context resolves to an existing row; otherwise, false.
IsValidRow(grid, row)
Checks whether a row index exists in the specified grid.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The grid containing the row. |
| row | Int32 | The zero-based row index. |
Returns: Boolean. True if the table is not disposed and the row index is in range.
NotifyRender(config)
Provides a hook for adjusting table state during grid rendering.
| Parameter | Type | Description |
|---|---|---|
| config | Object | The grid’s render configuration. |
The base implementation does nothing.
OnBeginEdit(grid, e)
Provides a hook invoked when a cell is about to enter edit mode.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellCancelEventArgs | The event data. |
The base implementation does nothing.
OnCausesValidationChanged(e)
Propagates the validation-trigger setting to both grids.
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | The setting-change event data. |
OnCellClick(grid, e)
Provides a hook invoked when a cell is clicked.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellEventArgs | The event data. |
The base implementation does nothing.
OnCellDoubleClick(grid, e)
Provides a hook invoked when a cell is double-clicked.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellEventArgs | The event data. |
The base implementation does nothing.
OnCellFormatting(grid, e)
Provides a hook invoked when the grid formats a cell for display.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellFormattingEventArgs | The event data. |
The base implementation does nothing.
OnCellValidated(grid, e)
Provides a hook invoked when cell validation completes.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellEventArgs | The event data. |
The base implementation does nothing.
OnCellValidating(grid, e)
Provides a hook invoked when a cell’s proposed value is being validated.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellValidatingEventArgs | The event data. |
The base implementation does nothing.
OnColumnHeaderMouseClick(grid, e)
Provides a hook invoked when a column header is clicked with the mouse.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellMouseEventArgs | The event data. |
The base implementation does nothing.
OnColumnHeaderMouseDoubleClick(grid, e)
Provides a hook invoked when a column header is double-clicked with the mouse.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellMouseEventArgs | The event data. |
The base implementation does nothing.
OnControlAdded(e)
Registers added SAL columns, redirecting them to the parent when this is an embedded table.
| Parameter | Type | Description |
|---|---|---|
| e | ControlEventArgs | The event data identifying the added control. |
OnControlRemoved(e)
Removes a departing SAL column from the live table before raising the base event.
| Parameter | Type | Description |
|---|---|---|
| e | ControlEventArgs | The removed control. |
OnCornerClick(grid, e)
Provides a hook invoked when the upper-left header cell is clicked.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellEventArgs | The event data. |
The base implementation does nothing.
OnCornerDoubleClick(grid, e)
Provides a hook invoked when the upper-left header cell is double-clicked.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellEventArgs | The event data. |
The base implementation does nothing.
OnCreateControl()
Attaches grid events and initializes column positions at runtime, then performs the initial layout.
OnCurrentCellChanged(grid, e)
Provides a hook invoked when the grid’s current cell changes.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | EventArgs | The event data. |
The base implementation does nothing.
OnDefaultRowHeightChanged(grid, e)
Provides a hook invoked when the grid’s default row height changes.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | EventArgs | The event data. |
The base implementation does nothing.
OnDoubleClick(grid, e)
Provides a hook invoked when the grid is double-clicked.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | EventArgs | The event data. |
The base implementation does nothing.
OnEditingControlShowing(grid, e)
Provides a hook invoked when the grid displays a cell editor.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewEditingControlShowingEventArgs | The event data. |
The base implementation does nothing.
OnEndEdit(grid, e)
Provides a hook invoked when a cell leaves edit mode.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellEventArgs | The event data. |
The base implementation does nothing.
OnFontChanged(e)
Propagates the table font to cell, row-header, and column-header styles in both grids.
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | The font-change event data. |
OnGotFocus(grid, e)
Provides a hook invoked when the grid receives focus.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | EventArgs | The event data. |
The base implementation does nothing.
OnLastCellTab(grid, e)
Provides a hook invoked when Tab is pressed in the grid’s last cell.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellEventArgs | The event data. |
The base implementation does nothing.
OnLostFocus(grid, e)
Provides a hook invoked when the grid loses focus.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | EventArgs | The event data. |
The base implementation does nothing.
OnRowEnter(grid, e)
Provides a hook invoked when the current cell enters a row.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellEventArgs | The event data. |
The base implementation does nothing.
OnRowHeaderMouseClick(grid, e)
Provides a hook invoked when a row header is clicked with the mouse.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellMouseEventArgs | The event data. |
The base implementation does nothing.
OnRowHeaderMouseDoubleClick(grid, e)
Provides a hook invoked when a row header is double-clicked with the mouse.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellMouseEventArgs | The event data. |
The base implementation does nothing.
OnRowValidated(grid, e)
Provides a hook invoked when row validation completes.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellEventArgs | The event data. |
The base implementation does nothing.
OnRowValidating(grid, e)
Provides a hook invoked when a row is being validated.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The main or split grid raising the event. |
| e | DataGridViewCellCancelEventArgs | The event data. |
The base implementation does nothing.
ResetRowsHeight(grid, height)
Sets the main grid’s default row height and resets each row size in the specified grid.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The grid whose individual row sizes are reset. |
| height | Int32 | The main grid’s new default row height in pixels. |
SelectFullRow(row)
Selects every cell in the specified row.
| Parameter | Type | Description |
|---|---|---|
| row | DataGridViewRow | The row to select, or null to do nothing. |
SetBoundsCore(x, y, width, height, specified)
Applies the requested bounds and rearranges the internal grids.
| Parameter | Type | Description |
|---|---|---|
| x | Int32 | The horizontal position in pixels. |
| y | Int32 | The vertical position in pixels. |
| width | Int32 | The width in pixels. |
| height | Int32 | The height in pixels. |
| specified | BoundsSpecified | The bounds components to update. |
SetContextRow(rowNum)
Selects a valid SAL row context and records its grid, row index, and current column.
| Parameter | Type | Description |
|---|---|---|
| rowNum | Int32 | The SAL row number, including a split-row context when applicable. |
Returns: Boolean. True if the context was resolved to an existing row; otherwise, false.
TestRowFlags(row, maskOn, maskOff)
Tests a nondeleted row against inclusion and exclusion flag masks.
| Parameter | Type | Description |
|---|---|---|
| row | SalTableRow | The row to test. |
| maskOn | Int32 | At least one of these flags must be present; zero imposes no inclusion requirement. |
| maskOff | Int32 | None of these flags may be present. |
Returns: Boolean. True when the row exists, is not deleted, and satisfies both masks.
TestRowHeaderFlags(flags)
Checks whether all requested row-header flags are enabled.
| Parameter | Type | Description |
|---|---|---|
| flags | Int32 | The flags to test. |
Returns: Boolean. True when every bit is set, including an empty mask.
TestTableFlags(flags)
Checks whether all requested table flags are enabled.
| Parameter | Type | Description |
|---|---|---|
| flags | Int32 | The flags to test. |
Returns: Boolean. True when every bit is set, including an empty mask.
TranslateRowContext(rowNum, rowIndex, grid)
Resolves a SAL row context into its internal grid and zero-based row index.
| Parameter | Type | Description |
|---|---|---|
| rowNum | Int32 | The SAL row context to resolve. |
| rowIndex | Int32 | Receives the translated index; it can be out of range when the method returns false. |
| grid | DataGridView | Receives the main or split grid selected by the context. |
Returns: Boolean. True if the translated row exists; otherwise, false.
The output arguments are initialized even on failure. Temporary rows and iteration boundaries do not resolve to existing rows.
TranslateRowIndex(row)
Converts an internal grid row into its SAL row context.
| Parameter | Type | Description |
|---|---|---|
| row | DataGridViewRow | The row to translate, or null. |
Returns: Int32. The SAL row context, or TBL_Error for null or a negative row index.
TranslateRowIndex(grid, rowIndex)
Converts an internal row index into a SAL row context, adding the split-row offset when applicable.
| Parameter | Type | Description |
|---|---|---|
| grid | DataGridView | The grid containing the row. |
| rowIndex | Int32 | The zero-based internal row index. |
Returns: Int32. TBL_Error for a negative index; otherwise, the ordinary or split-row context.
This method does not check the upper bound of the row index.
UpdateColumnHeaders()
Provides a hook for synchronizing SAL column headers.
The base implementation does nothing.
UpdateColumnWidths()
Provides a hook for synchronizing SAL column widths.
The base implementation does nothing.
UpdateRowHeaders()
Refreshes row headers in the main grid and, when present, the split grid.
Inherited By
| Name | Description |
|---|---|
| SalTableWindow | Displays SAL table rows and columns in a web grid, with row contexts, split rows, validation messages, and SQL population. |