GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TK::TIXGRID (3)

.ds Aq ’

NAME

Tk::TixGrid - Create and manipulate Tix Grid widgets

CONTENTS

SYNOPSIS

$tixgrid = $parent-><B>TixGridB>?(options)?;

DESCRIPTION

This widget is intended as the basis of spread sheet like interfaces. The 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. Because these items need not be windows large grids can be handled without consuming excessive display system resources.

Individual cells, or groups of cells, can be formatted with a wide range of attributes, such as its color, relief and border. However because the widget is intended to handle large grids the mechanisms to achieve these are lower level, and more callback oriented than for other widgets. The assumption is that to avoid storing display details of a large number of cells, the data will be re-computed as needed.

The port of Tix C code and some of the bindings to perl/Tk is done but still need further work. In several places the intent of the Tix code is not yet understood. For example the ’edit’ interface is clearly intended for spread-sheet like cell content editing in an auxillary entry widget or similar, but how that should work is not yet clear.

The <B>TixGridB> method creates a new TixGrid window and returns a blessed reference of this TixGrid widget. Additional options, described below, may be specified on the command line or in the option database to configure aspects of the <B>TixGridB> widget.

STANDARD OPTIONS

<B>-backgroundB>
        <B>-borderwidthB>
        <B>-cursorB>
        <B>-fontB>
        <B>-foregroundB>
        <B>-heightB>
        <B>-highlightbackgroundB>
        <B>-highlightcolorB>
        <B>-highlightthicknessB>
        <B>-padxB>
        <B>-padyB>
        <B>-reliefB>
        <B>-selectbackgroundB>
        <B>-selectborderwidthB>
        <B>-selectforegroundB>
        <B>-stateB>
        <B>-takefocusB>
        <B>-widthB>
        <B>-xscrollcommandB>
        <B>-yscrollcommandB>

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

WIDGET-SPECIFIC OPTIONS

Name:  <B>browseCmdB>
Class: <B>BrowseCmdB>
Switch:        <B>-browsecmdB> 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:  <B>CommandB>
Class: <B>CommandB>
Switch:        <B>-commandB> If defined, gives a perl/Tk callback to be executed when the user double-clicks 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 that has just been clicked.
Name:  <B>editDoneCmdB>
Class: <B>EditDoneCmdB>
Switch:        <B>-editdonecmdB> 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:  <B>editNotifyCmdB>
Class: <B>EditNotifyCmdB>
Switch:        <B>-editnotifycmdB> 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: <B>trueB> indicates that the cell is editable and <B>falseB> otherwise.
Name:  <B>FloatingColsB>
Class: <B>floatingColsB>
Switch:        <B>-floatingcolsB> Defines the number of extra columns beyond the existing grid that can be brought into view by scrolling.
Name:  <B>FloatingRowsB>
Class: <B>floatingRowsB>
Switch:        <B>-floatingrowsB> Defines the number of extra rows beyond the the existing grid that can be brought into view by scrolling.
Name:  <B>formatCmdB>
Class: <B>FormatCmdB>
Switch:        <B>-formatcmdB> If defined, gives a perl/Tk callback to be executed when the grid cells need to be displayed on the screen. Its primary purpose is to draw the background of the region before the cells are rendered on top. This is normally achieved by calling <B>formatGridB> or <B>formatBorderB> (see below). However other uses can be made of this low-level callback. For example it can be used to lazily populate the grid by calling the <B>setB> method only as cells come into view.

When this callback is called, it is passed with five additional parameters: type x1 y1 x2 y2.

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

type gives the logical type of the region in the grid. It may be one of the following.
<B>x_marginB> The horizontal margin.
<B>y_marginB> The vertical margin.
<B>s_marginB> The area in the top left corner where the horizontal and vertical margins are joined.
<B>mainB> The main body i.e. all the cells that do not fall into the above three types.

Name:  <B>leftMarginB>
Class: <B>LeftMarginB>
Switch:        <B>-leftmarginB> Gives the width of vertical margin in cells (columns). A zero indicates that no vertical margin exists. A positive value N indicates that first N columns are labels and are always displayed and not scrolled.
Name:  <B>itemTypeB>
Class: <B>ItemTypeB>
Switch:        <B>-itemtypeB> Default item type for cells.
Name:  <B>selectModeB>
Class: <B>SelectModeB>
Switch:        <B>-selectmodeB> 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 <B>singleB>, <B>browseB>, <B>multipleB>, or <B>extendedB>; the default value is <B>singleB>.
Name:  <B>selectUnitB>
Class: <B>SelectUnitB>
Switch:        <B>-selectunitB> Specifies the selection unit. Valid values are <B>cellB>, <B>columnB> or <B>rowB>.
Name:  <B>sizeCmdB>
Class: <B>SizeCmdB>
Switch:        <B>-sizecmdB> Callback is called (with no extra arguments) when grid sizes are re-computed. For example if window changes size, a different font is specified etc.

It is called just after scrollbars (if present) are updated.

Name:  <B>topMarginB>
Class: <B>TopMarginB>
Switch:        <B>-topmarginB> Gives the width of horizontal margin in cells (rows). A zero indicates that no horizontal margin exists. A positive value N indicates that first N rows are labels and are always displayed and not scrolled.

WIDGET METHODS

The <B>TixGridB> 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-><B>methodB>?(arg, arg, ...)?

args determine the exact behavior of the method.

This object supports the <B>configureB> and <B>cgetB> methods described in Tk::options which can be used to enquire and modify the options described above. The widget also inherits all the methods provided by the generic Tk::Widget class.

The following additional methods are possible for <B>TixGridB> widgets:
$tixgrid-><B>anchorGetB>(x, y)
$tixgrid-><B>anchorSetB>(x, y)
$tixgrid-><B>anchorClearB> Manipulates the <B>anchor cellB> of the <B>TixGridB> widget. The anchor cell is the end of the selection that is fixed while the user is dragging out a selection with the mouse.
($bd,$col,$row) = $tixgrid-><B>bdtypeB>(x,y ?,xDelta,yDelta?) Determines if the the screen (pixel) position x,y is in a border. This is useful for changing the mouse cursor when the user points at a border - e.g. to indicate that the border can be adjusted interactively.

If in a border returns a list of three elements. First element is ’xy’, ’x’ or ’y’, second two elements are integers. (Value of these are not understood, seem to indicate which column and row of the border the screen position corresponds to?)

If not in a border returns an empty list.

$tixgrid-><B>deleteB>(dim, from?, to?)
$tixgrid-><B>deleteColumnB>(from?, to?)
$tixgrid-><B>deleteRowB>(from?, to?) Dim may be <B>rowB> or <B>columnB>. 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-><B>dragsiteB>(option, x, y)
$tixgrid-><B>dropsiteB>(option, x, y) Tcl/Tix has (or was going to have) Drag&Drop support. Meaning for perl/Tk is not clear yet.
$tixgrid-><B>editApplyB> If any cell is being edited, de-highlight the cell and applies the changes.
$tixgrid-><B>editSetB>(x, y) Highlights the cell at (x,y) for editing, if the <B>-editnotifyB> callback returns true for this cell.
$tixgrid-><B>entrycgetB>(x, y, ’-option’)
$tixgrid-><B>entryconfigureB>(x, y?, -option??=>value, -option=>value, ...?) Provide a configue interface to cells in the grid. The -options depend on the item type of the cell.
$tixgrid-><B>formatBorderB>(x1,y1, x2,y2, options);
$tixgrid-><B>formatGridB>(x1,y1, x2,y2, options); The <B>formatBorderB> and <B>formatBorderB> methods can only be called by the <B>-formatcmdB> callback of the tixGrid widget. They draw the background of the region described by x1,y1, x2,y2 according the the supplied options. One call to <B>-formatcmdB> callback can make multiple calls to <B>formatBorderB> and/or <B>formatBorderB> for different sub-regions.

<B>formatBorderB> draws the background using Tk relief style, <B>formatGridB> also draws grid lines between the cells. It only makes sense to call one or the other for a particular sub-region as one will over-write the other.

The options allowed are:
-background / -bg
-borderwidth / -bd
-filled
-relief
-selectbackground
-xoff
-xon
-yoff
-yon

The <B>-xon/-xoff and -yon/-yoffB> options are obscure. If anyone can figure out how to do something interesting given what pTk/tixGrFmt.c is doing with them please let Nick know!.

$tixgrid-><B>geometryinfoB>(?width, height?) Returns list of four values - two sets of two floating point numbers. First set is the scrollbar fractions for x direction, second set is scrollbar fractions for y direction. If width and height are specified then fractions are based on as if window size was of specified size (in pixels, but not allowing normal GetPixels units). Otherwise fractions are based on current size of the window.

Usage obscure.

$tixgrid-><B>indexB>(xcoord, ycoord) Retuns (x, y) of entry at position ($coordx, $coordy). Either coordinate may be <B>’max’B> which is largest existing entry in that direction, <B>’end’B> which is one beyond largest existing entry, or a number. (This is how you find out how big the grid is.)
$tixgrid-><B>infoBboxB>(x,y) Return the pixel bounding box of the cell at x,y.
$tixgrid-><B>infoExistsB>(x,y) Returns true if there is an item in the cell at x,y. Throws an exception (dies) if x,y is outside the grid - this may change (Nick doesn’t like it).
$tixgrid-><B>moveB>(dim, from, to, offset)
$tixgrid-><B>moveColumnB>(from, to, offset)
$tixgrid-><B>moveRowB>(from, to, offset) Dim may be <B>rowB> or <B>columnB>. Moves the range of rows (or columns) from position from through to by the distance indicated by offset. For example, $tixgrid-><B>moveRowB>(<B>2B>, <B>4B>, <B>1B>) moves the rows 2,3,4 to rows 3,4,5.
$tixgrid-><B>nearestB>(x, y) Screen pos (pixels) to entry (nx,ny) translation.
$tixgrid-><B>selectionAdjustB>(x1, y1 ?,x2, y2?)
$tixgrid-><B>selectionClearB>(x1, y1 ?,x2, y2?)
$tixgrid-><B>selectionIncludesB>(x1, y1 ?,x2, y2?)
$tixgrid-><B>selectionSetB>(x1, y1 ?,x2, y2?)
$tixgrid-><B>selectionToggleB>(x1, y1 ?,x2, y2?) Selection support methods - probably buggy.

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

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

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

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

$tixgrid-><B>setB>(x, y?, <B>-itemtypeB>=>type??, -option=>value, ...?) Creates a new display item at the cell at (x,y). The optional <B>-itemtypeB> 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-><B>sizeB>(dim, index?, -option??=>value, ...?)
$tixgrid-><B>sizeColumnB>(index?, -option??=>value, ...?)
$tixgrid-><B>sizeRowB>(index?, -option??=>value, ...?) Queries or sets the size of the row or column given by dim and index. Dim may be <B>rowB> or <B>columnB>. Index may be any non-negative integer that gives the position of a given row (or column). Index can also be the string <B>defaultB>; 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:
<B>-pad0B> => pixels Specifies the paddings to the left of a column or the top of a row.
<B>-pad1B> => pixels Specifies the paddings to the right of a column or the bottom of a row.
<B>-sizeB> => val Specifies the width of a column or the height of a row. Val may be: <B>autoB> — the width of the column is set the widest cell in the column; a valid Tk screen distance unit (see <B>Tk_GetPixelsB>); or a real number following by the word <B>charsB> (e.g. <B>3.4charsB>) that sets the width of the column to the given number of characters.
$tixgrid-><B>sortB>(dimension, start, end, ?args ...?) ?docu here? (not supported on Win* OSs up to now)
$tixgrid-><B>unsetB>(x, y) Clears the cell at (x,y) by removing its display item.
$tixgrid-><B>xviewB> Normal horizontal scrollbar method.
$tixgrid-><B>yviewB> Normal vertical scrollbar method.

BINDINGS

To be done - only most obvious basic bindings work. The Tcl/Tix code was coded as a state machine which is not easy to follow.

SEE ALSO

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

BUGS

Tcl/Tix was/is not finished and both C code and bindings of TixGrid have some bugs.

KEYWORDS

tix, tixgrid, table, display item, spreadsheet
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TIXGRID (3) 2013-11-15

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.