Class Fox::FXTable |
|
Table Widget
The following messages are sent by FXTable to its target:
SEL_COMMAND: | sent when a new item is clicked; the message data is an FXTablePos instance indicating the current cell. |
SEL_KEYPRESS: | sent when a key goes down; the message data is an FXEvent instance. |
SEL_KEYRELEASE: | sent when a key goes up; the message data is an FXEvent instance. |
SEL_LEFTBUTTONPRESS: | sent when the left mouse button goes down; the message data is an FXEvent instance. |
SEL_LEFTBUTTONRELEASE: | sent when the left mouse button goes up; the message data is an FXEvent instance. |
SEL_RIGHTBUTTONPRESS: | sent when the left mouse button goes down; the message data is an FXEvent instance. |
SEL_RIGHTBUTTONRELEASE: | sent when the left mouse button goes up; the message data is an FXEvent instance. |
SEL_SELECTED: | sent when a cell is selected; the message data is an FXTablePos instance indicating the position of the selected cell. |
SEL_DESELECTED: | sent when a cell is deselected; the message data is an FXTablePos instance indicating the position of the deselected cell. |
SEL_CHANGED: | sent when the current cell changes; the message data is an FXTablePos instance indicating the current cell. |
SEL_CLICKED: | sent when a cell is single-clicked; the message data is an FXTablePos instance indicating the current cell. |
SEL_DOUBLECLICKED: | sent when a cell is double-clicked; the message data is an FXTablePos instance indicating the current cell. |
SEL_TRIPLECLICKED: | sent when a cell is triple-clicked; the message data is an FXTablePos instance indicating the current cell. |
SEL_DELETED: | sent when a range of cells is about to be removed; the message data is an FXTableRange instance indicating the cells to be removed. |
SEL_INSERTED: | sent when a range of cells has been inserted; the message data is an FXTableRange instance indicating the cells inserted. |
TABLE_COL_SIZABLE: | Columns are resizable |
TABLE_ROW_SIZABLE: | Rows are resizable |
TABLE_NO_COLSELECT: | Disallow column selections |
TABLE_NO_ROWSELECT: | Disallow row selections |
ID_HORZ_GRID: | x |
ID_VERT_GRID: | x |
ID_DELETE_COLUMN: | x |
ID_DELETE_ROW: | x |
ID_INSERT_COLUMN: | x |
ID_INSERT_ROW: | x |
ID_SELECT_COLUMN: | x |
ID_SELECT_ROW: | x |
ID_SELECT_CELL: | x |
ID_SELECT_ALL: | x |
ID_DESELECT_ALL: | x |
ID_MOVE_LEFT: | x |
ID_MOVE_RIGHT: | x |
ID_MOVE_UP: | x |
ID_MOVE_DOWN: | x |
ID_MOVE_HOME: | x |
ID_MOVE_END: | x |
ID_MOVE_TOP: | x |
ID_MOVE_BOTTOM: | x |
ID_MOVE_PAGEDOWN: | x |
ID_MOVE_PAGEUP: | x |
ID_MARK: | x |
ID_EXTEND: | x |
ID_CUT_SEL: | x |
ID_COPY_SEL: | x |
ID_PASTE_SEL: | x |
ID_BLINK: | x |
Methods |
Attributes |
anchorColumn | [R] | Column number for anchor cell [Integer] |
anchorRow | [R] | Row number for anchor cell [Integer] |
baseColor | [RW] | Base GUI color [FXColor] |
borderColor | [RW] | Border color [FXColor] |
cellBorderColor | [RW] | Cell border color [FXColor] |
cellBorderWidth | [RW] | Cell border width, in pixels [Integer] |
currentColumn | [R] | Column number for current cell [Integer] |
currentRow | [R] | Row number for current cell [Integer] |
defColumnWidth | [RW] | Default column width, in pixels [Integer] |
defRowHeight | [RW] | Default row height, in pixels [Integer] |
font | [RW] | Text font [FXFont] |
gridColor | [RW] | Grid color [FXColor] |
helpText | [RW] | Status line help text [String] |
hiliteColor | [RW] | Highlight color [FXColor] |
leadingCols | [RW] | Number of leading columns [Integer] |
leadingRows | [RW] | Number of leading rows [Integer] |
marginBottom | [RW] | Bottom cell margin, in pixels [Integer] |
marginLeft | [RW] | Left cell margin, in pixels [Integer] |
marginRight | [RW] | Right cell margin, in pixels [Integer] |
marginTop | [RW] | Top cell margin, in pixels [Integer] |
numCols | [R] | Number of columns [Integer] |
numRows | [R] | Number of rows [Integer] |
selBackColor | [RW] | Background color for selected cell(s) [FXColor] |
selTextColor | [RW] | Text color for selected cell(s) [FXColor] |
shadowColor | [RW] | Shadow color [FXColor] |
stippleColor | [RW] | Stipple color [FXColor] |
tableStyle | [RW] | Table style [Integer] |
textColor | [RW] | Text color [FXColor] |
trailingCols | [RW] | Number of trailing columns [Integer] |
trailingRows | [RW] | Number of trailing rows [Integer] |
visibleCols | [RW] | Number of visible columns [Integer] |
visibleRows | [RW] | Number of visible rows [Integer] |
Included modules |
Public Class methods |
csvType() |
Returns the drag type for CSV data
csvTypeName() |
Returns the drag type name for CSV data
new(p, visRows, visCols, tgt=nil, sel=0, opts=0, x=0, y=0, w=0, h=0, pl=DEFAULT_MARGIN, pr=DEFAULT_MARGIN, pt=DEFAULT_MARGIN, pb=DEFAULT_MARGIN) {|theTable| ...} |
Make new table with visRows visible rows and visCols visible columns; the table is initially empty, i.e. contains no cells (numRows and numCols are both zero).
Public Instance methods |
horizontalGridShown?() |
Is horizontal grid shown?
verticalGridShown?() |
Is vertical grid shown?
showHorzGrid(on=true) |
Show or hide horizontal grid
showVertGrid(on=true) |
Show or hide vertical grid
setTableSize(numRows, numCols, notify=false) |
Resize the table content to numRows rows and numCols columns. If notify is true, then
rowAtY(y) |
Determine row containing y; returns -1 if y outside of table
colAtX(x) |
Determine column containing x; returns -1 if x outside of table
getItem(row, column) |
Return the item (a reference to an FXTableItem) at the given row and column. Raises IndexError if either row or column is out of bounds.
setItem(row, column, item) |
Replace the item at the given row and column with a (possibly subclassed) item. Raises IndexError if either row or column is out of bounds.
makePositionVisible(row, column) |
Scroll to make cell at (row, column) fully visible. Raises IndexError if either row or column is out of bounds.
setColumnWidth(column, columnWidth) |
Set column width. Raises IndexError if column is out of bounds.
getColumnWidth(column) |
Get column width. Raises IndexError if column is out of bounds.
setRowHeight(row, rowHeight) |
Set row height. Raises IndexError if row is out of bounds.
getRowHeight(row) |
Get row height. Raises IndexError if row is out of bounds.
setColumnX(column, x) |
Set x-coordinate for column. Raises IndexError if column is out of bounds.
getColumnX(column) |
Get x-coordinate of column. Raises IndexError if column is out of bounds.
setRowY(row, y) |
Set y-coordinate of row. Raises IndexError if row is out of bounds.
getRowY(row) |
Get y-coordinate of row. Raises IndexError if row is out of bounds.
setItemText(row, column, text) |
Modify cell text for item at specified row and column. Raises IndexError if either row or column is out of bounds.
getItemText(row, column) |
Return cell text for item at specified row and column. Raises IndexError if either row or column is out of bounds.
setItemIcon(row, column, icon) |
Modify cell icon. Raises IndexError if either row or column is out of bounds.
getItemIcon(row, column) |
Return item icon. Raises IndexError if either row or column is out of bounds.
setItemData(row, column, data) |
Modify cell user data. Raises IndexError if either row or column is out of bounds.
getItemData(row, column) |
Return cell user data. Raises IndexError if either row or column is out of bounds.
itemSelected?(row, column) |
Returns true if the cell at position (row, column) is selected. Raises IndexError if either row or column is out of bounds.
itemCurrent?(row, column) |
Returns true if the cell at position (row, column) is the current cell. Raises IndexError if either row or column is out of bounds.
itemVisible?(row, column) |
Returns true if the cell at position (row, column) is visible. Raises IndexError if either row or column is out of bounds.
itemEnabled?(row, column) |
Returns true if the cell at position (row, column) is enabled. Raises IndexError if either row or column is out of bounds.
updateRange(startRow, endRow, startCol, endCol) |
Repaint cells between grid lines (startRow, endRow) and grid lines (startCol, endCol). Raises IndexError if any of the starting or ending grid lines is out of bounds.
updateItem(row, column) |
Repaint cell. Raises IndexError if either row or column is out of bounds.
enableItem(row, column) |
Enable cell. Raises IndexError if either row or column is out of bounds.
disableItem(row, column) |
Disable cell. Raises IndexError if either row or column is out of bounds.
selectItem(row, column, notify=false) |
Select cell. If notify is true, a SEL_SELECTED message is sent to the table’s message target after the item is selected. Raises IndexError if either row or column is out of bounds.
deselectItem(row, column, notify=false) |
Deselect cell. If notify is true, a SEL_DESELECTED message is sent to the table’s message target after the item is deselected. Raises IndexError if either row or column is out of bounds.
toggleItem(row, column, notify=false) |
Toggle cell. If notify is true, a SEL_SELECTED or SEL_DESELECTED message is sent to the table’s message target after the item is (de)selected. Raises IndexError if either row or column is out of bounds.
setCurrentItem(row, column, notify=false) |
Change current cell. If notify is true, a SEL_CHANGED message is sent to the table’s message target after the current item changes. Raises IndexError if either row or column is out of bounds.
setAnchorItem(row, column) |
Change anchored cell. Raises IndexError if either row or column is out of bounds.
selectRange(startRow, endRow, startColumn, endColumn, notify=false) |
Select range. If notify is true, a SEL_SELECTED message is sent to the table’s message target for each newly-selected cell. Raises IndexError if startRow, endRow, startColumn or endColumn is out of bounds.
extendSelection(row, column, notify=false) |
Extend selection. If notify is true, a series of SEL_SELECTED and SEL_DESELECTED messages are sent to the table’s message target after each affected item is selected or deselected. Raises IndexError if either row or column is out of bounds.
killSelection(notify=false) |
Kill selection. If notify is true, a SEL_DESELECTED message is sent to the table’s message target for each cell that was previously selected.
setCellColor(row, column, color) |
Change cell background color. The values for row and column are either zero or one. If the value is zero, this background color is used for even-numbered rows (columns). If the value is one, this background color is used for odd-numbered rows (columns). See also getCellColor.
getCellColor(row, column) |
Obtain cell background color. The values for row and column are either zero or one. If the value is zero, returns the background color used for even-numbered rows (columns). If the value is one, returns the background color used for odd-numbered rows (columns). See also setCellColor.
createItem(text, icon, data) |
Create a new table item
drawCell(dc, xlo, xhi, ylo, yhi, xoff, yoff, startRow, endRow, startCol, endCol) |
Draw a table cell
drawRange(dc, xlo, xhi, ylo, yhi, xoff, yoff, rlo, rhi, clo, chi) |
Draw a range of cells
insertRows(row, numRows=1, notify=false) |
Insert numRows rows beginning at the specified row number. If row is equal to the number of rows in the table, the new rows are added to the bottom of the table. If notify is true, a SEL_INSERTED message is sent to the table’s message target for each cell that is inserted. Raises IndexError if row is out of bounds.
insertColumns(column, numColumns=1, notify=false) |
Insert numColumns columns beginning at the specified column number. If column is equal to the number of columns in the table, the new columns are added to the right of the table. If notify is true, a SEL_INSERTED message is sent to the table’s message target for each cell that is inserted. Raises IndexError if column is out of bounds.
removeRows(row, nr=1, notify=false) |
Remove the nr rows starting at the specified row. If notify is true, a SEL_DELETED message is sent to the table’s message target for each cell that is removed. Raises IndexError if row is less than zero, or if row + nr is greater than the current number of table rows.
removeColumns(column, nc=1, notify=false) |
Remove the nc columns starting at the specified column. If notify is true, a SEL_DELETED message is sent to the table’s message target for each cell that is removed. Raises IndexError if column is less than zero, or if column + nc is greater than the current number of table columns.
removeItem(row, column, notify=false) |
Remove item at (row, column). If notify is true, a SEL_DELETED message is sent to the table’s message target after this cell is removed. Raises IndexError if either row or column is out of bounds.
each_row() {|itemArray| ...} |
Calls block once for each row in the table, passing an array of references (one element per column) as a parameter.
each_column() {|itemArray| ...} |
Calls block once for each column in the table, passing an array of references (one element per row) as a parameter.
each() |
Alias for each_row