Input Help

The MathletFactory contains a built-in support for an input help allowing users to enter numbers, function expressions and text in symbolic visualisations of MM-Objects in an efficient way. This help system is based on input hints (which are presented as buttons to the user) and allows to integrate the definitions of valid variables in function expressions as input hints.

Valid Variables

Function expressions may define valid variables for checking user input in symbolic function representations. This is done by registering a list of variable identifiers in an operation via the setValidVariables(String[] validVariables) method in the classes Operation and MOpNumber. An empty list means that no variables at all are allowed, a null list means that all variables are allowed.

Whenever the user enters a function expression containing a variable not contained in this list, an error tooltip will be shown and the symbolic visualisation will remain in editing mode.

  • MOpNumber's setUseVariables(boolean) method is based on this technique. Calling this method is equivalent to a null list for true arguments and to an empty list for false arguments of the setUseVariables(boolean) method.
  • changes of the list of valid variables will only be transfered into the visualisation via the render() method.


1. Registering a valid variable in a MMFunctionDefByOp object:

MMFunctionDefByOp f = ...
f.getOperation().setValidVariables(new String[] { "x_{n}" });

2. Registering a valid variable in a MMOpNumber object:

MMOpNumber n = ...
n.setValidVariables(new String[] { "alpha" });

Activation with Applet Parameters

The input help can be controlled globally for a mathlet with the following applet parameters:
  • enableInputHelp: enables globally the input help for a mathlet when set to true; false will disable the input help (default value)
  • embedInputHelp: embeds the input help directly into the mathlet when set to true (default value); false will cause the input hints to be shown in a distinct window *
  • globalInputHints: defines a list of input hints used for symbolic visualisations for every MM-Object
  • globalFunctionInputHints: defines a list of input hints used for all functions in a mathlet
  • the input help will be disabled if the option embedInputHelp is set to false and the [[.:embedding_mode|embedding mode]] is set to applet (inline mode) due to focus issues with the Java plugin.

The following example shows how to activate the input help with [[..:extensions:runtime_properties|runtime properties]] inside the properties.xml file of a mathlet:

    <mf:property name="enableInputHelp" type="string" value="true"/>

Display Properties

Although the input hint are based on display properties, the developer will use the TextInputDisplayProperties rarely. The follwing circumstances may cause the direct usage of this class:
  • input hints containing multiple variables and/or functions are desired
  • the text/label/description of input hints should be changed
  • input hints for variables should be available but no error checking for valid variables is desired
  • global settings should be performed via Java code rather than applet parameters
The following static methods are available in TextInputDisplayProperties:
  • setInputHintData(String inputHint, String text, String label, String description): sets the data for an input hint (see [[.:input_help#input_hint_data|Input Hint Data]])
  • enableInputHelp(boolean): enables globally the input help; equivalent to the applet parameter enableInputHelp
The following instance methods are available in TextInputDisplayProperties:
  • addInputHints(String[] inputHints): registers the given list of input hints
  • setUseValidVariables(boolean): sets whether valid variables from operations should be used as input hints


1. Define an input hint which should not be treated as valid variable:

MMFunctionDefByOp f = ...
TextInputDisplayProperties inputProps = new TextInputDisplayProperties();
inputProps.addInputHints(new String[] { "x_{n}" });

2. Define a valid variable which should not be used as input hint:

MMFunctionDefByOp f = ...
f.getOperation().setValidVariables(new String[] { "x_{n}" });
TextInputDisplayProperties inputProps = new TextInputDisplayProperties();

3. Change the text, label and description for the input hint x:

TextInputDisplayProperties.setInputHintData("x", "x", "x", "My Special Variable");

Input Hint Data

Every input hint is referenced by an unique name/identifier/key. It has the following properties:
  • text: the text to be inserted into the textfield
  • label: the text to be displayed on the button (may contain TeX commands)
  • description: the text to be displayed in a tooltip (must NOT contain TeX; HTML is allowed)

Predefined Input Hints

Small Greek letters: alpha, beta, gamma, delta, epsilon, zeta, eta, theta, iota, kappa, lambda, mu, nu, xi, omicron, pi, rho, sigma, tau, upsilon, phi, chi, psi, omega

Big Greek letters: ALPHA, BETA, ...

Name Description
+ Insert plus sign
- Insert minus sign
* Insert multiplication sign
/ Insert division sign
. Insert decimal sign
, Insert decimal sign
i Insert imaginary number
infinity Insert infinity
sqrt Insert square root
^ Insert superscript
_ Insert index
abs Insert absolute value
fac Insert factorial sign
conj Insert complex conjugated
cbrt Insert cubic root
sign Insert signum function
re Insert real part function
im Insert imaginary part function
ln Insert logarithmus naturalis
log Insert logarithmus naturalis
exp Insert exponential function
cos Insert cosine function
cosh Insert hyperbolic cosine function
acos Insert inverse cosine function
acosh Insert inverse hyperbolic cosine function
sin Insert sine function
sinh Insert hyperbolic sine function
asin Insert inverse sine function
asinh Insert inverse hyperbolic sine function
tan Insert tangent function
tanh Insert hyperbolic tangent function
atan Insert inverse tangent function
atanh Insert inverse hyperbolic tangent function
cot Insert cotangent function
coth Insert hyperbolic cotangent function
acot Insert inverse cotangent function
acoth Insert inverse hyperbolic cotangent function

Add picture from clipboard (Maximum size: 500 MB)