Class Fox::FXTable

In: | FXTable.rb ../lib/fox/iterators.rb
Parent: | FXScrollArea

Table Widget

# Attributes

visibleRows: | number of visible rows [Integer]
visibleCols: | number of visible columns [Integer]
numRows: | number of rows [Integer]
numCols: | number of columns [Integer]
marginTop: | top cell margin, in pixels [Integer]
marginBottom: | bottom cell margin, in pixels [Integer]
marginLeft: | left cell margin, in pixels [Integer]
marginRight: | right cell margin, in pixels [Integer]
tableStyle: | table style [Integer]
leadingRows: | number of leading rows [Integer]
trailingRows: | number of trailing rows [Integer]
leadingCols: | number of leading columns [Integer]
trailingCols: | number of trailing columns [Integer]
defColumnWidth: | default column width, in pixels [Integer]
defRowHeight: | default row height, in pixels [Integer]
currentRow: | row number for current cell [Integer]
currentColumn: | column number for current cell [Integer]
anchorRow: | row number for anchor cell [Integer]
anchorColumn: | column number for anchor cell [Integer]
font: | text font [FXFont]
textColor: | text color [FXColor]
baseColor: | base GUI color [FXColor]
hiliteColor: | highlight color [FXColor]
shadowColor: | shadow color [FXColor]
borderColor: | border color [FXColor]
selBackColor: | background color for selected cell(s) [FXColor]
selTextColor: | text color for selected cell(s) [FXColor]
gridColor: | grid color [FXColor]
stippleColor: | stipple color [FXColor]
cellBorderColor: | cell border color [FXColor]
cellBorderWidth: | cell border width, in pixels [Integer]
helpText: | status line help text [String]

# Events

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 options

`TABLE_COL_SIZABLE`: | Columns are resizable
`TABLE_ROW_SIZABLE`: | Rows are resizable
`TABLE_NO_COLSELECT`: | Disallow column selections
`TABLE_NO_ROWSELECT`: | Disallow row selections

# Message identifiers

`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

colAtX createItem csvType csvTypeName deselectItem disableItem drawCell drawRange each each_column each_row enableItem extendSelection getCellColor getColumnWidth getColumnX getItem getItemData getItemIcon getItemText getRowHeight getRowY horizontalGridShown? insertColumns insertRows itemCurrent? itemEnabled? itemSelected? itemVisible? killSelection makePositionVisible new removeColumns removeItem removeRows rowAtY selectItem selectRange setAnchorItem setCellColor setColumnWidth setColumnX setCurrentItem setItem setItemData setItemIcon setItemText setRowHeight setRowY setTableSize showHorzGrid showVertGrid toggleItem updateItem updateRange verticalGridShown?

Attributes

anchorColumn | [R] |
anchorRow | [R] |
baseColor | [RW] |
borderColor | [RW] |
cellBorderColor | [RW] |
cellBorderWidth | [RW] |
currentColumn | [R] |
currentRow | [R] |
defColumnWidth | [RW] |
defRowHeight | [RW] |
font | [RW] |
gridColor | [RW] |
helpText | [RW] |
hiliteColor | [RW] |
leadingCols | [RW] |
leadingRows | [RW] |
marginBottom | [RW] |
marginLeft | [RW] |
marginRight | [RW] |
marginTop | [RW] |
numCols | [R] |
numRows | [R] |
selBackColor | [RW] |
selTextColor | [RW] |
shadowColor | [RW] |
stippleColor | [RW] |
tableStyle | [RW] |
textColor | [RW] |
trailingCols | [RW] |
trailingRows | [RW] |
visibleCols | [RW] |
visibleRows | [RW] |

Included modules

Enumerable

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

- a `SEL_DELETED` message will be sent to the table's message target indicating which cells (if any) are about to be destroyed as a result of the resize;
- a `SEL_INSERTED` message will be sent to the table's message target indicating which cells (if any) were added as a result of the resize; and,
- a `SEL_CHANGED` message will be sent to the table's message target indicating the new current cell.

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.

This method is also aliased as each

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