J6/Grid/Methods

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

The following are the methods of the base jzgrid class.

Except where otherwise indicated, row,column positions are absolute positions into the total data. This ignores any scroll or transpose, and whether the data is a matrix or a list of columns.

Isigraph event handler methods

The following methods handle isigraph events.

Method Description
char character event handler
mbldbl mouse button left double click
mbldown mouse button left down
mblup mouse button left up
mbrdbl mouse button right double click
mbrdown mouse button right down
mbrup mouse button right up
mmove mouse button move
paint paint event handler

Grid event handler methods

The following methods handle grid events. Each calls the grid handler (if defined) in the parent form, with an argument of the event name:

Method Description
change after cells have changed and before CELLDATA is updated
click mouse left click in grid
dblclick mouse left double click in grid
destroy immediately before the grid is destroyed
edit immediately before the grid enters edit mode
enter Enter pressed in cell, if not in edit mode or combo list selection
get get data request in virtual mode
gridsort immediately before the grid is sorted

Future releases may add other calls to the grid handler.

Other methods

The following are the remaining public methods of the base jzgrid class.

Method Description
create create grid object
destroy destroy grid object
readblock read block of cells
readcell read single cell
readmark read mark
readsize read size of display
setnames set grid information without refreshing grid display
show show grid
writeblock write block of cells
writecell write cell
writemark write mark
zoomin/out zoom in or out

create - The create method defines global locP as the locale of the parent form. This can be given as the argument to create, otherwise if the argument is empty, the locale is assumed to be COCREATOR.

destroy - Destroy the grid object.

readblock - Read block of cells from CELLDATA. Argument is row, column, #rows, #cols. Result has the same layout as CELLDATA.

readcell - Read cell from CELLDATA. Argument is row, column.

readmark - Read currently marked cells, or cell block. Result is one of:

  • empty - no cell is marked
  • 2 integers - row,column of marked cell
  • 4 integers - row,column of latest marked cell, row,column of originally marked cell.

readsize - read size of display. If y is empty, this returns the size in pixels required to display the grid in full. For virtual grids, this is the current data that has been read in. If y is given, it is the width,height that is allowed to display the grid (e.g. the current isigraph window size). This can be used to resize the form to fit the grid. Note that the result when y is given may be larger than when y is empty, because scrollbars may be needed when the size is limited.

The following example shows that the grid display is shorter than the available width, but at least requires all the available height:

   readsize 500 300
350 300

setnames - Set grid information without refreshing the grid. The argument specifies options to be set in the grid object, either as:

  • a character string of names that can be read by the grid from the form locale.
  • a 2 column boxed matrix of names and corresponding values.

show - Show or refresh the grid. The argument specifies options to be set in the grid object, either as:

  • a character string of names that can be read by the grid from the form locale.
  • a 2 column boxed matrix of names and corresponding values.

writeblock - Write block of cells from CELLDATA. The new data can be in any of the forms acceptable for defining CELLDATA. Form is:

new writeblock row,col

writecell - Write cell to CELLDATA. Form is:

new writecell row,col

writemark - Write mark cell or cell block. Argument has one of the forms that result from readmark.

zoomin, zoomout - scales the grid. For example, assign a form ctrl+b key to make the font bigger, and ctrl+shift+b to make it smaller:

form_bctrl_fkey=: 3 : 'zoomin__grid y'
form_bctrlshift_fkey=: 3 : 'zoomout__grid y'