Input Modules
What are input modules on Terminaux?
Input modules are components that describe how the input is going to be shown to users, and the actual implementation of the input, such as the method of telling users to provide an input.
Definition
They are defined in a single abstract InputModule class that contains the necessary properties and functions that describe an input. Additionally, the derived classes may implement the two functions that work on rendering the input placeholder and processing user input, RenderInput() and ProcessInput().
The following built-in input methods are available:
ComboBoxModule
Select an item (single choice)
MaskedTextBoxModule
Text box with hidden characters as mask
MultiComboBoxModule
Select multiple items (multiple choices)
SliderBoxModule
Select a number visually
TextBoxModule
Text box
CharBoxModule
Text box that accepts one character
TimeBoxModule
Time box
DateBoxModule
Date box
Usage
You can use an information box that supports input modules, called InfoBoxMultiInputColor. It allows you to specify an array of input modules. You can also make presentations use the input modules to customize the flow of the presentations according to the user input.
In order to be able to use those modules, you'll need to instantiate a class and to fill the necessary fields that are required for modules to be distinguishable. An example code shown below shows the definitions of the three types of input modules:
For all input modules, Name and Description properties must be filled when instantiating such modules for reachability.
Extra requirements
Some of the modules might require extra information to be supplied by the caller. Here are some of the built-in modules which require extra properties to be filled:
ComboBoxModule
Choices
Specifies a list of choices
MultiComboBoxModule
Choices
Specifies a list of choices
SliderBoxModule
MinPos
Specifies a minimum value
MaxPos
Specifies a maximum value
Value
Specifies the current value
Custom input modules
In order to make your own derived input module class, you must inherit from the base InputModule class, which will require implementing the following abstract functions:
RenderInput()ProcessInput()
It's recommended that RenderInput() respect the width field in the function parameter to maintain uniform look. Here's an example as to how to get a value and adjust the rendered input as per the width field:
Input pop-over
ProcessInput() uses the inputPopoverPos and the inputPopoverSize fields to determine where to render the popover, which could either:
Render over the rendered input placeholder with
RenderInput(), orRender under the input placeholder, such as combo boxes with selection choices.
Some of the components that use input modules handle extra popover height, which you can handle it yourself using the ExtraPopoverHeight property. You can override it when declaring a new input module.
Customized rendering
In customized applications, you may have to render the input yourself using the RenderInput() function and to process the input yourself using the above function. Additionally, you may have to calculate the popover position yourself. It's usually located at the same position as the rendered input, but there are cases where you may need to render it just below the rendered input.
Last updated