Chapter Contents


SAS/AF Software: Class Dictionary


The Table Editor class is part of a collection of classes that combine to create the Data Form and Data Table classes. These classes work together to enable you to

Unless you are customizing the table editor or you are using a model other than the original Data Set Data Model class provided, do not use this class. Use the Data Table class instead.

Before you customize the functionality of these classes, you should understand the structure of these classes and how they communicate.

The Table Editor class provides the ability to display, print, and interact with rectangular (tabular) data. The display and printed output are graphical, as proportional fonts can be used, and the interaction includes column and row resizing, and cell selection and editing.

The table editor can utilize data from a variety of sources. The data source is a separate object referred to as the model, which should be a subclass of SASHELP.FSP.TABLE_M.CLASS (for example, Data Set Data Model). The table editor is associated with a particular model using the _attach method (for example, Data Set Data Model). This separation of data and view is known as the Model-View-Controller (MVC) paradigm.

The Table Editor compartmentalizes the data into four categories -- column labels, row labels, titles, and data cells.

The column and row labels and the titles are collectively known as the label cells. Each of these label areas can contain a hierarchy. This is known as a multidimensional table. Each strip or level in the hierarchy is a separate dimension.

A dimension that does not span the entire table is known as a group. The column, row, and title dimensions are also referred to as the nonscrollable area of the table because they are always displayed as the table is scrolled. See the _setAttributes method for information on hiding these areas.

Scrolling only affects the data or scrollable area. The scroll thumb position always reflects the current position in the data, and its size reflects the percentage of the total number of elements (rows or columns) that are visible. You can add to the nonscrollable area by holding columns and rows. For more information see the _setHeldColumns and _setHeldRows methods.

The column and row dimensions may be unbounded or dynamic in the case where the total number of elements in the dimension is unknown or changing. Such tables are horizontally and/or vertically dynamic. For example, a data table object with an active WHERE clause can be called vertically dynamic. Only single-dimension hierarchies can be dynamic.

While the label dimensions can be hierarchical, the data area is simply a checkerboard of cells formed by the intersection of the leaf (bottom dimension) rows and columns. This area can be visually divided along these rows and columns by spanning horizontal and vertical lines, which are collectively known as the grid. You can control the color, style, and width of the grid lines via the methods prefixed by _setGrid.

Do not confuse grid lines with cell borders. A cell border is a line drawn around the boundary of a cell. The exterior edge of this border is flush with the cell's boundary; thus, it does not intrude on any neighboring cells. Like grid lines, the color, style, and width of these lines can be controlled; see the methods that contain border in their names. Also see the LABEL_BUTTONS and DATA_BUTTONS attributes to create borders with a push-button appearance. Note that grid lines are drawn before cell borders so that the borders will be on top of the grid.

In addition to borders, you can control cell colors, fonts, margins, and justification. The table editor allows you to define defaults for each of these attributes for both label and data cells. Methods prefixed with _setLabel affect label cells while data cell defaults are specified with the _setData methods. For example, you can use the _setDataBackgroundColor method to change the default background color for all data cells. Note that the model can override any of these defaults.

You can select cells interactively or programmatically. Single clicking on a cell establishes it as the current or active cell. By default, the table editor uses host-based controls when its cells are edited. When a user edits a particular cell in a specified column, the host control appears when the cell is set to the active cell. Supported host controls that you can apply to a cell to assist with editing include a text entry control (the default), a spin box control, and a combo box control.

The active cell is the cell to which keystrokes are directed. The table editor distinguishes the active cell with either a flashing cursor (when the host-based controls are used) or with a border known as the active cell indicator, which can be moved with the cursor keys. You can also select or highlight a contiguous range of cells. Dragging the mouse highlights any touched cells establishing a selected area. Selecting a row or column highlights all of the cells contained within it. Clicking in any cell unselects the area.

Double clicking on a cell not only makes it active, but it enables cell edit mode if the cell is not protected. Cell edit mode provides within-cell editing -- the text cursor is placed on the letter on which you clicked, and the left and right cursor keys move the text cursor rather than the active cell indicator. You can terminate cell edit mode by clicking on another cell, tabbing or moving the cursor to another cell, pressing return, issuing a command, or scrolling. You can also edit unprotected cells by making them active and typing a character. However in this case, the typed character replaces the previous contents of the cell, and the left and right cursor keys move you from cell to cell rather than from letter to letter. This can be useful when entering a row or column of data. Note that not all models allow editing.

Note:   If host controls are active for a data table and the object label is set to run on a double-click event, the object label may not execute until a user makes a third click in the table. The first click that the user makes actually sets focus to the data table, which then requires two additional clicks to run its object label.  [cautionend]

You can resize rows and columns by grabbing on or near their respective borders. The mouse shape changes as it is moved across a border to indicate that it can be grabbed. This change in mouse shape is a result of cursor tracking being enabled for the table editor and thus allows you to also resize rows and/or columns. If you were to disable the ability to resize the rows and/or co columns in your table editor, then cursor tracking would be turned off by default. Even label cells without displayed borders can be resized; simply place the mouse cursor along the cell's edge. Note that not all models allow resizing.

The term table editor is used as a general term and should be interpreted as a data table, a table editor, or a subclass of a table editor.

Parent: sashelp.fsp.Widget.class

Class: sashelp.fsp.Table_e.class

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.