NAME

Tk::TixGrid - Create and manipulate Tix Grid widgets

SYNOPSIS

$tixgrid = $parent->TixGrid?(options)?;

The port of C code and bindings is done but needs
debugging.  THERE ARE KNOWN BUGS. Work in progress ...

STANDARD OPTIONS

-background -borderwidth -cursor -font -foreground -height -highlightbackground -highlightcolor -highlightthickness -padx -pady -relief -selectbackground -selectborderwidth -selectforeground -state -takefocus -width -xscrollcommand -yscrollcommand

See Tk::options for details of the standard options.

WIDGET-SPECIFIC OPTIONS

Name: browseCmd
Class: BrowseCmd
Switch: -browsecmd

?docu here? Not in configure output but used in bindings ??!!

If defined, gives a perl/Tk callback to be executed when the user browses a grid cell (This is normally the case when the user clicks on an entry). When this callback is called, it is passed with two additional parameters: x y, where (x,y) is the location of the cell that has just been clicked.

Name: Command
Class: Command
Switch: -command

?docu here? Not in configure output but used in bindings ??!!

Name: editDoneCmd
Class: EditDoneCmd
Switch: -editdonecmd

If defined, gives a perl/Tk callback to be executed when the user has edited grid cell. When this callback is called, it is passed with two additional parameters: x y, where (x,y) is the location of the cell that has just been edited.

Name: editNotifyCmd
Class: EditNotifyCmd
Switch: -editnotifycmd

If defined gives a perl/Tk callback to be executed when the user tries to edit a grid cell. When this callback is called, it is passed with two additional parameters: x y, where (x,y,) is the location of the cell. This callback should return a boolean value: true indicates that the cell is editable and false otherwise.

Name: FloatingCols
Class: floatingCols
Switch: -floatingcols

Defines the number of columns that fixed when the widget is horizontally scrolled. These column(s) can be used as label(s) for the column(s). The floating column(s) can be configured in the -formatcmd callback with the formatBorder method. The default value is 0.

Name: FloatingRows
Class: floatingRows
Switch: -floatingrows

Defines the number of rows that are fixed when the widget is vertically scrolled. These row(s) can be used as label(s) for the row(s). The floating row(s) can be configured in the -formatcmd callback with the formatBorder method. The default value is 0.

Name: formatCmd
Class: FormatCmd
Switch: -formatcmd

If defined, gives a perl/Tk callback to be executed when the grid cells need to be formatted on the screen. Normally, this callback calls the format method (see below). When this callback is called, it is passed with five additional parameters: type x1 y1 x2 y2. type gives the logical type of the region in the grid. It may be one of the following.

x-region

the horizontal margin

y-region

the vertical margin

s-region

the area where the horizontal and vertical margins are joined

main

all the cells that do not fall into the above three types

x1 y1 x2 y2 gives the extent of the region that needs formatting.

Name: leftMargin
Class: LeftMargin
Switch: -leftmargin

In the number of cells, gives the width of vertical margin. A zero indicates that no vertical should be drawn.

Name: itemType
Class: ItemType
Switch: -itemtype

?docu here?

Name: selectMode
Class: SelectMode
Switch: -selectmode

Specifies one of several styles for manipulating the selection. The value of the option may be arbitrary, but the default bindings expect it to be either single, browse, multiple, or extended; the default value is single.

Name: selectUnit
Class: SelectUnit
Switch: -selectunit

Specifies the selection unit. Valid values are cell, column or row.

Name: sizeCmd
Class: SizeCmd
Switch: -sizecmd

?docu here?

Name: topMargin
Class: TopMargin
Switch: -topmargin

In the number of cells, gives the height of horizontal margin. A zero indicates that no horizontal should be drawn.

DESCRIPTION

The TixGrid method creates a TixGrid new window and returns a blessed reference of this TixGrid widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the TixGrid widget such as its cursor and relief.

A Grid widget displays its contents in a two dimensional grid of cells. Each cell may contain one Tix display item, which may be in text, graphics or other formats. See Tk::DItem for more information about Tix display items. Individual cells, or groups of cells, can be formatted with a wide range of attributes, such as its color, relief and border.

WIDGET METHODS

The TixGrid method creates a TixGrid widget and returns a blessed reference of this TixGrid widget. This reference may be used to invoke various operations on the widget. It has the following general form:

$tixgrid->method?(arg, arg, ...)?

args determine the exact behavior of the method. The following methods are possible for TixGrid widgets:

$tixgrid->anchor(action, x, y)
$tixgrid->anchorAction(x, y)

Manipulates the anchor cell of the TixGrid widget. The anchor cell is the end of the selection that is fixed while the user is dragging out a selection with the mouse. Action can be clear, get or set. If action is clear, x and y args are not accepted.

$tixgrid->bdtype(x, y ?,xbdWidth, ybdWidth?)

????

$tixgrid->cget('-option')

Returns the current value of the configuration option given by -option. -option may have any of the values accepted by the TixGrid constructor method.

$tixgrid->configure(?-option??=>value, -option=>value, ...?)

Query or modify the configuration options of the widget. If no -option is specified, returns a list describing all of the available options for $tixgrid (see Tk_ConfigureInfo for information on the format of this list.) If -option is specified with no value, then the method returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no -option is specified). If one or more option-value pairs are specified, then the method modifies the given widget option(s) to have the given value(s); in this case the method returns an empty string. -option may have any of the values accepted by the TixGrid constructor method.

$tixgrid->delete(dim, from?, to?)
$tixgrid->deleteColumn(from?, to?)
$tixgrid->deleteRow(from?, to?)

Dim may be row or column. If to is not given, deletes a single row (or column) at the position from. If to is given, deletes the range of rows (or columns) from position from through to.

$tixgrid->dragsite(option, x, y)

?docu here? not implemented :-(

$tixgrid->dropsite(option, x, y)

?docu here? not implemented :-(

$tixgrid->editApply

If any cell is being edited, de-highlight the cell and applies the changes.

$tixgrid->editSet(x, y)

Highlights the cell at (x,y) for editing, if the -editnotify callback returns true for this cell.

$tixgrid->entrycget(x, y, '-option')

Returns the current value of the configuration option given by -option of the cell at (x,y). -option may have any of the values accepted by the set method.

$tixgrid->entryconfigure(x, y?, -option??=>value, -option=>value, ...?)

Query or modify the configuration options of the cell at (x,y). If no -option is specified, returns a list describing all of the available options for the cell (see Tk_ConfigureInfo for information on the format of this list.) If -option is specified with no value, then the method returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no -option is specified.) If one or more option-value pairs are specified, then the method modifies the given widget option(s) to have the given value(s); in this case the method returns an empty string. Option may have any of the values accepted by the set method.

$tixgrid->format(option, ?args, ...?)
$tixgrid->formatBorder(x1,y1, x2,y2, options);
$tixgrid->formatGrid(x1,y1, x2,y2, options);

the format method can only be called by the -formatcmd callback of the tixGrid widget.

?docu complete?

$tixgrid->geometryinfo(?width, ?height, ...?)

?docu here? Return a list of 4 floats! Currently "{first1 last1} {first2,last2}" :-(

$tixgrid->index($coordx, $coordy)

?docu here?

retuns (nx, ny) of entry at position ($coordx, $coordy). (??widget or screen offset??)

$tixgrid->info(option, ?args, ...?)

?docu here?

$tixgrid->move(dim, from, to, offset)
$tixgrid->moveColumn(from, to, offset)
$tixgrid->moveRow(from, to, offset)

Dim may be row or column. Moves the range of rows (or columns) from position from through to by the distance indicated by offset. For example, $tixgrid->moveRow(2, 4, 1) moves the rows 2,3,4 to rows 3,4,5.

$tixgrid->nearest(x, y)

?docu here? screen pos (pixels) to entry (nx,ny) translation.

$tixgrid->selection(option, x1, y1 ?,x2, y2?)
$tixgrid->selectionOption(x1, y1 ?,x2, y2?)

Option one of: adjust, clear, includes, set, and toggle.

x1 (y1) has not to be greater than x2 (y2), but only x2 and y2 can be 'max'.

BUG: selection includes: has no visible effect (as in Tix). Eh???

BUG: selection clear: only works for 0, 0, max, max (as in Tix). Eh???

When x2, y2 are not given they default to x1, y1, respectively.

$tixgrid->selectionAdjust(x1, y1 ?,x2, y2?)

?docu here?

$tixgrid->selectionClear(x1, y1 ?,x2, y2?)

?docu here?

$tixgrid->selectionIncludes(x1, y1 ?,x2, y2?)

?docu here?

$tixgrid->selectionSet(x1, y1 ?,x2, y2?)

?docu here?

$tixgrid->selectionToggle(x1, y1 ?,x2, y2?)

?docu here?

$tixgrid->set(x, y?, -itemtype=>type??, -option=>value, ...?)

Creates a new display item at the cell at (x,y). The optional -itemtype parameter gives the type of the display item. An additional list of option-value pairs specify options of the display item. If a display item already exists at this cell, the old item will be deleted automatically.

$tixgrid->size(dim, index?, -option??=>value, ...?)
$tixgrid->sizeColumn(index?, -option??=>value, ...?)
$tixgrid->sizeRow(index?, -option??=>value, ...?)

Queries or sets the size of the row or column given by dim and index. Dim may be row or column. Index may be any non-negative integer that gives the position of a given row (or column). Index can also be the string default; in this case, this method queries or sets the default size of all rows (or columns). When no option-value pair is given, this method returns a list containing the current size setting of the given row (or column). When option-value pairs are given, the corresponding options of the size setting of the given row are changed. -option may be one of the following:

-pad0 => pixels

Specifies the paddings to the left of a column or the top of a row.

-pad1 => pixels

Specifies the paddings to the right of a column or the bottom of a row.

-size => val

Specifies the width of a column or the height of a row. Val may be: auto -- the width of the column is set the widest cell in the column; a valid Tk screen distance unit (see Tk_GetPixels); or a real number following by the word chars (e.g. 3.4chars) that sets the width of the column to the given number of characters.

$tixgrid->sort(dimension, start, end, ?args ...?)

?docu here? (not supported on Win* OSs up to now)

$tixgrid->unset(x, y)

Clears the cell at (x,y) by removing its display item.

$tixgrid->xview

?docu here?

$tixgrid->yview

?docu here?

BINDINGS

to be done.

SEE ALSO

Tk::DItem Tk::callbacks Tk::FloatEntry

BUGS

C code and bindings of TixGrid have some bugs.

KEYWORDS

tix, tixgrid, table, display item, spreadsheet