XRT/table: Tables, Lists and Forms Widget
XRT/table allows you to easily display and manipulate tables and forms in your Motif applications. Flexible and fast, XRT/table is ideal for applications that access stored text or image data such as lists and databases, or for displaying dynamic tabular data on the fly. With its virtual table capabilities, XRT/table can manage even your largest data display requirements. And widget-in-cell technology gives you complete control over the user interface. A wide range of output options are available, including EPS, JPG and PNG. With more than 150 resources, XRT/table is flexible enough for almost any task, yet easy to use.
Table Data
Table data can be specified programmatically, read from a file, or input by end users. Text strings, Motif compound strings, standard widgets and pixmap data (XBM or XPM format) are supported for cell values. Applications using real-time data or with huge tables can use callback routines to display cell and label values only when necessary. XRT/table can handle huge tables because it only evaluates cell contents for the cells which are displayed. You can display up to 2 billion rows and 2 billions columns, depending on available memory. There are routines included to read and copy data from XRT/graph and XRT/3d.
Table Components
rows and columns
You can add, delete, move, freeze and hide rows and columns. End users can resize them using mouse.
cells
Cell width is specified by a number of characters or pixels; cell height is specified by a number of text lines or pixels. Cell values can be displayed overflowing to the adjacent cells. Multiple cells can be spanned, or combined to make a larger cell. Borders have styles that can include shadows and etching. Traversing can be turned on or off for specified cells. Cell size, highlight, fonts, alignment and colors can be controlled.
title
A text widget or any other widget can be used to display a title for the table. The XrtLabel widget can be used for titles, supporting text rotation and PostScript output.
User Interaction
Users can resize rows and columns dynamically. Special marks are provided to indicate cells which do not display complete cell values. Cell selection can be made for an individual cell, a range of cells, a whole row or column, and even non-contiguous cells. The drag and drop functionality of Motif 1.2 is supported to enable cut, copy and paste within the same table or to and from other widgets. XRT/table manages two XmScrollbar widgets and displays them automatically when the table is larger than the display window.
Callbacks
Callbacks for cell editing, validation, selection, traversing and resizing are provided.
Printing
XRT/table provides Postscript output. Specific printing options are provided for page delimiter, page labels, scaling, margins, color, range, and for the handling of frozen cells.
Property Editor
XRT/table can be used with XRT/graph and XRT/3d. There are example programs included which show how to connect XRT/table with XRT/graph and XRT/3d so that updates to one widget automatically update the other. For example, dragging a point in the XRT/3d graph appearing in the image to the right will update values in the table, and changing values in the table will be updated in the graph.
Import and Export
Table data can be imported from comma delimited ASCII files. Data can be output to SYLK or ASCII format.
Other functions
XRT/table also supports batching of table updates, sorting, spreadsheet label formats and cell flashing.
Resources
All XRT/table attributes can be programmed using resources, allowing you to prototype your table's look and behavior without recompiling.
XRT/table provides context resources, which are used to specify particular cells, rows, columns, labels and ranges. For example, a context could be set to one cell (cell[3,4]), a whole row, a label, row 5, or the whole table. Resources can then be set or retrieved for the context. For example, background color, text alignment, fonts, cell values could be set or retrieved for a context.
The following code sets cell[3,4]'s background color to yellow, the column label to blue, and other areas to red.
XtVaSetValues(mytable, XmNxrtTblContext, XrtTblSetContext(XRTTBL_ALL, XRTTBL_ALL), XmNxrtTblBackgroundContext, "red", NULL); XtVaSetValues(mytable, XmNxrtTblContext, XrtTblSetContext(XRTTBL_LABEL, XRTTBL_ALL), XmNxrtTblBackgroundContext, "blue", NULL); XtVaSetValues(mytable, XmNxrtTblContext, XrtTblSetContext(3, 4), XmNxrtTblBackgroundContext, "yellow", NULL);
XRT/table also provides a C++ interface.
table->setContext(XRTTBL_ALL, XRTTBL_ALL); table->setBackgroundContext("red"); table->setContext(XRTTBL_LABEL, XRTTBL_ALL); table->setBackgroundContext("blue"); table->setContext(3, 4); table->setBackgroundContext("yellow");
Series resources can be used to set multiple contexts. The following code shows a series set in an XRT/table resource file.
*.xrtTblBackgroundSeries: (ALL ALL red) (LABEL ALL blue) (3 4 yellow)
More XRT/table example images can be found here.