Previous Up Next

5.4.10  The CST variable

The menu available with the cust button in the bandeau on the onscreen keyboard (see Section 3.2, item 3.2) is defined with the CST variable. It is a list where each list item determines a menu item; a list item is either a builtin command name or a list itself consisting of a string to be displayed in the menu and the input to be entered when the item is selected.

For example, to create a custom defined menu with the builtin function diff, a user defined function foo, and a menu item to insert the number 22/7, you can:
Input:

CST:= [diff,["foo",foo],["My pi approx",22/7]]

Note that if the input to be entered is a variable and the variable has a value when CST is defined, then CST will contain the value of the variable. For example,
Input:

app:= 22/7
CST:= [diff,["foo",foo],["My pi approx",app]]

will be equivalent to the previous definition of CST. However, if the variable does not have a value when CST is defined, for example:
Input:

CST:= [diff,["foo",foo],["My pi approx",app]]
app:= 22/7

then CST will behave as the previous values to begin with, but in this case if the variable app is changed, the the result of pressing the My pi approx button will change also.

Since CST is a list, a function can be added to the cust menu with the concat command (see Section 6.40.13);
Input:

CST:= concat(CST,evalc)

will add the evalc command to the cust menu.


Previous Up Next