CellOnClick


Release:

4.6 •  5.0 •  5.1 •  5.2 •  5.3 •  5.4 •  6.0 •  6.1 •  6.2 •  6.3 •  6.4 •  6.5 •  6.6 •  7.0 •  7.1

This function is not available prior to Analytica 5.0

CellOnClick( expr )

A cell format predicate that specifies an expression to be evaluated when a user double-clicks on a table cell (for example in a result table). This can be configured from within a computed cell format in the Cell Format Expression attribute. The expression «expr» is allowed to have side-effects, such as assignments to global variables, in the same way an OnClick or OnChange expression can.

Use this function when you want to enable do some custom action when a user double-clicks on a particular cell in a result table. This behaves similarly to having a Button inside a table.

CellOnClick in row or column header cells

If you want to respond to clicks in a row header cell or column header cell, as with any other cell format predicate, you'll need to use CellSpan and specify the index and «header». For example

CellSpan( PlantType, CellOnClick( DoClickOnPlant(Self), header:true ) )

where PlantType is an index, and DoClickOnPlant is a UDF with one parameter.

Coordinates of the cell

Prior to Analytica 5.2, the expression «expr» does not have direct access to the coordinates of the cell that was clicked.


Local Variables

Local variables cannot be used inside «expr» prior to Analytica 5.2


Continuing with default response

The return value of «expr» communicates whether the click was handled. Any value other than False (0), including Null, means that the processing of the click is complete, and any other handling of the click should not occur. False means that handling is not complete and the default processing of the click should continue.

When a cell in a result table contains a handle, the default behavior in the absence of a CellOnClick handler is to jump to the variable pointed to by the handle. Normally, by handling the CellOnClick, you override this with your own «expr», so that the hyperlink is not followed (unless your code follows it by calling e.g., ShowWindow). Similarly, when the cell contains a reference, double clicking will open a result window to the value pointed to by the reference. In some cases, you may want to have the default still run after your handler finishes. This will occur when your «expr» returns False. If it returns any other value (including Null), the default behavior is not executed.

Examples

With the following Cell Format Expression, when the user double-clicks on any cell in the I='b' row of the result table, the user interface will open the influence diagram for the module Mo1.

If I='b' Then CellOnClick( ShowWindow( Handle(Mo1), 'Diagram' ) )

When the user clicks on any cell in the table, a message box shows the value at full precision.

CellOnClick( MsgBox( NumberToText(Self,fullPrecision:true) ) )

History

CellOnClick was introduced in Analytica 5.0.

Access to local variables and the coordinate of the cell clicked from within the «expr» expression were added in Analytica 5.2.

See Also

Comments


You are not allowed to post comments.