From J Wiki
Jump to navigation Jump to search
J6/Grid | Data Options Types | Actions Events Methods | Class DerivedClass | Hierarchical MultiDimensional MultiLine Virtual | Examples

Grid options are grouped by the area of the grid that is affected. For this, the grid can be visualized as follows:

│top header│col header│
│row header│cells     │

The option groups are:

CELL options related to cells, i.e. the data area
COL options related to columns, both header and data columns
GRID options related to the grid as a whole
HDRCOL column headers
HDRROW row headers (labels)
HDRTOP top headers

Option List

CELLALIGN cell horizontal alignment
CELLALIGNV cell vertical alignment
CELLCOLOR cell color, index into CELLCOLORS
CELLCOLORS cell color matrix
CELLDATA cell data
CELLDRAW cell raw data
CELLEDIT if cell editable flag
CELLFMT cell format
CELLFONT cell font, index into CELLFONTS
CELLFONTS boxed list of fonts for cells
CELLHIGH highlighted cells
CELLITEMS cell selection lists
CELLMARK marked cell
CELLMARKER if marked cells are highlighted
CELLMASK if cell is masked
CELLMASKCOLOR color of masked cell
CELLOVERFLOW if cell overflow permitted
CELLRANGE range of indices into virtual data
CELLTYPE cell type
COLAUTOFIT if column autofit
COLMINWIDTH minimum column width
COLRESIZE if columns are user resizable
COLSCALE column scale
GRIDBACKCOLOR background colors
GRIDBORDER if border drawn around grid area
GRIDCOLOR grid colors
GRIDESCCANCEL if Esc handled by parent
GRIDEXTERN external drawing program
GRIDFLIP if flip flag
GRIDHWNDC handle of isigraph control
GRIDID id of isigraph control
GRIDLINES if show grid lines
GRIDLOC name of grid locale in parent
GRIDMARGIN margin settings
GRIDPID id of parent form
GRIDROWMODE if row mode
GRIDSBMINWIDTH scrollbar minimum height/width
GRIDSORT if grid can be sorted
GRIDVIRTUALMODE if grid operates in virtual mode
GRIDWINDOW grid window
GRIDZOOM zoom factor
HDRCOL column headers
HDRCOLALIGN column header alignment
HDRCOLMERGE if column header merge
HDRCOLOR header color
HDRFONT header font
HDRROW row labels
HDRROWALIGN row label alignment
HDRROWMERGE if row label merge
HDRSTYLE header style
HDRTOP topleft header
HDRTOPALIGN topleft header alignment
ROWMINHEIGHT minimum row height

CELLALIGN - Alignment 0=left,1=center,2=right. A singleton, list for each column, or matrix for each cell.

CELLALIGNV - Alignment 0=top,1=middle,2=bottom. A singleton, list for each column, or matrix for each cell.

CELLCOLOR - Cell color as index into CELLCOLORS. A singleton, list for each column, or matrix for each cell.

CELLCOLORS -Table of colors, indexed by CELLCOLOR. Each row has up to 8 colors (24 numbers):

0 normal text
1 normal background
2 marked text
3 marked background
4-7 highlight for 0-3

Default is a 2 row table of 8 colors that alternate light yellow and white rows, where the mark color is a light blue, see CELLCOLORS in locale jzgrid.

CELLDATA - Data for grid. See grid Data.

CELLDRAW - Raw data for grid. This is optional, and is used only for sorting. If given, sorts are made on CELLDRAW, otherwise sorts are made on CELLDATA.

CELLEDIT - If editable flag, default 1. A singleton, list for each column, or matrix for each cell.

CELLFMT - Format specifications for grid data. See grid Data.

CELLFONT - Cell font as index into CELLFONTS.

CELLFONTS - Boxed list of cell fonts.

CELLHIGH - Mask of highlighted cells.

CELLITEMS - Boxed list. Each item is a boxed list of selections for combobox cells.

CELLMARK - Currently marked cell. Either 2 numbers, row, column, for a single cell, or 4 numbers for a marked area: current cell, initially marked cell. This is set by the grid when in use, but it can be redefined by the parent form to move the mark.

Use verbs readmark and writemark to read and write the mark.

CELLMARKER - If marked cells are highlighted, i.e. surrounded with a thick border

CELLMASK - If cells are masked out (not shown). The default is 0, i.e. show all. A boolean matrix has 1 for each cell not shown. For example, see the grid demo Development Triangle.

CELLMASKCOLOR - Color of masked cells.

CELLOVERFLOW - If cell overflow flag, default 1. A singleton, list for each column, or matrix for each cell.

CELLRANGE - Range of indices for virtual cell data. This is maximum horizontal index, maximum vertical index, i.e. <: |. $DATA .

CELLTYPE - Grid data types. See [grid_data.htm Grid Data].

COLAUTOFIT - 1 if column autofit. If on, then column widths are sized to ensure that all text in the columns is visible. In this case, the COLWIDTH setting is the minimum column width. See also Sizes.

COLMINWIDTH - Minimum column width. A singleton, or a list for each column. This applies to all columns, including the header row label columns. See also Sizes.

COLRESIZE - 1 if columns can be resized by the user. See also Sizes.

COLSCALE - Column scale factors. This is a numeric list of length up to the number of data columns. If given, then the grid tries to resize the cell columns so that all columns are visible, subject to COLMINWIDTH. The resizing takes into account COLSCALE. Columns with zero scale values are not resized. See also Sizes.

For example, resize first column only:


Resize first 4 columns. The scale factor for the fourth column is twice that of the other columns:

COLSCALE=: 1 1 1 2

COLWIDTH - Column widths. A singleton, or list for all columns. If COLAUTOFIT is 1, this is the minimum width, and if COLAUTOFIT is 0, this is the actual width (subject to COLMINWIDTH and COLSCALE). See also Sizes.

GRIDBACKCOLOR - Grid backgrounds, default COLOR_BTNFACE. Two colors may be given, for inside the scrollbars and outside the scrollbars.

GRIDBORDER - 1 if a border is drawn around grid area

GRIDBUTTONCOLOR - Color table used to draw buttons. Defaults use system colors:

2 light shadow COLOR_BTNSHADOW
4 dark shadow COLOR_3DDKSHADOW

GRIDCOLOR - List of 5 colors used to draw the grid.

0 grid lines SILVER 192 192 192
1 border BLACK 0 0 0
2 light (in header) WHITE 255 255 255
3 shadow (in header) DARKGRAY 169 169 169
4 mark outline DARKSLATEGRAY 47 79 79

GRIDESCCANCEL - 1 if pressing Esc calls parent form_cancel

GRIDEXTERN - If given, this is a verb that is called whenever the grid is drawn.

GRIDFLIP - 1 if grid is flipped (transposed).

GRIDHWNDC - The handle of the isigraph control. In J8 and later, the value should be a scalar integer. In J6, this value is represented as a string of characters rather than a scalar integer.

GRIDID - ID of isigraph control, default grid .

GRIDLINES - If horizontal grid lines displayed, if vertical grid lines displayed, default 1 1.

GRIDLOC - Name of grid locale in parent, default same as GRIDID. This is used to create default event handlers for the isigraph control. It is the name of the grid instance. For example, if in the form the grid instance is created as:

mygrid=: conew 'jzgrid'

then GRIDLOC should be defined as 'mygrid'. It is convenient to use the same name as the isigraph control id, so the default is correct.

GRIDMARGIN - cell margins in pixels, apply to both data cells and header cells. This is 4 integers: x-margin, horizontal padding, y-margin, vertical padding, default 4 6 2 0.

GRIDPID - A string giving the ID of the parent form. The default is the active form id. This should be given where the event handler parent is not the active form, for example, if the grid is displayed on a tab on the active form.

GRIDROWMODE - 1 if the grid operates in row mode, i.e. selection bar is by row

GRIDSBMINWIDTH - Scrollbar minimum height/width in pixels, default 0.

GRIDSORT - If the grid can be sorted, default 0. If 1, then click on the column header to sort the data by column. This signals the gridsort event. Clicking a second time reverses the order of the sort.

The sort is based on CELLDATA, not on formatted data. CELLDATA and corresponding globals are changed. Global SortIndex has the sort indices, e.g if CELLDATA is a matrix, then the original data is CELLDATA /: SortIndex.

Sorting is not supported by row, if the grid is flipped, or for virtual data.

GRIDVIRTUALMODE - 1 if grid operates in virtual mode. In this case, the get event is signaled whenever the grid needs new data.

GRIDWINDOW - these are top,left,right,bottom offsets into the isigraph control window, and allow the grid to be subset to a specific area. Default is all 0, i.e. the entire control is used.

GRIDZOOM - Grid zoom factor, default 1.

HDRCOL - List or matrix of column headers. These are normally character strings, but the following scalar settings are accepted:

integer N N + 0 1 2 3...
A A, B, ... Z, AA, AB, ... AAA ...

HDRCOLALIGN - Column header alignments. Singleton, list or matrix (0=left, 1=center, 2=right).

HDRCOLMERGE - Boolean list, where 1 signifies that the corresponding column header row can be merged. If so, then adjacent cells with the same column name are merged.

HDRCOLOR - List of 4 colors, i.e. 12 integers:

0 normal background COLOR_BTNFACE
1 normal text BLACK
2 highlight background reverse of COLOR_BTN_FACE
3 highlight text WHITE

HDRFONT - Font used in header.

HDRROW - List or matrix of row headers (i.e. row labels). This can also take the same scalar settings as HDRCOL.

HDRROWALIGN - Row header alignments. Singleton, list or matrix (0=left, 1=center, 2=right).

HDRROWMERGE - Boolean list, where 1 signifies that the corresponding row header column can be merged. If so, then adjacent cells with the same row name are merged.

HDRSTYLE - Header style.

0 3D no border
1 3D with border (default)
2 2=raised (no border)

HDRTOP - List or matrix of top headers. These fit in the area at the top left of the grid, i.e. to the left of the column headers and above the row headers.

HDRTOPALIGN - Top header alignments. Singleton, list or matrix (0=left, 1=center, 2=right).

ROWMINHEIGHT - Minimum row height. A singleton, or a list for each row. This applies to all rows, including the header column label rows. See also Sizes.