Previous Up Next

4.6.2  The CST variable

The menu available with the cust button on the onscreen keyboard 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 set

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

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

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

CST := concat(CST,evalc)

will add the evalc command to the cust menu.


Previous Up Next