Configuring a Scratchpad
Now that an FMC Screen has been created, you may notice that a new FmcScratchpad
class is created and passed to the FmcScreen class.
The FmcScratchpad
is responsible for displaying the text input that the FMC currently contains, and as such will need to be configured and styled appropriately.
Scratchpad Options
When instantiating the FmcScratchpad
class, it takes three parameters, the first being an EventBus
, the second being a partial FmcScratchpadOptions
interface, and the third being an FmcRenderCallback
function.
The FmcScratchpadOptions
interface takes the following options:
renderRow
[number
]
optional
This parameter sets the row on which the scratchpad will be rendered, defaulting to the last row.
cellWidth
[number
]
optional
This parameter sets the cell width of the scratchpad, limiting the length of the input that will be shown. By default this is set to 16, but it is advised to explicitly set it.
style
[string
]
optional
This parameter allows for custom styling to be set on the displayed text, this parameter is the name of any CSS classes which will be applied to the scratchpad input.
By default white
styling is applied.
For more information on how styling is applied see this page.
deleteText
[string
]
optional
This parameter sets the text displayed in the scratchpad when a DELETE (or equivalent) entry is being made. By default this will show DELETE.
surroundingText
[[string, string]
]
optional
This parameter sets the text that surrounds any scratchpad input. It takes the form of the tuple [string, string]
, where the first value is the string displayed on the left, and the second is the string displayed on the right. By default this is undefined.
For example on the WT21 where the scratchpad shows entry in the style [INPUT HERE ]
, this parameter would need to be set to ['[', ']']
.
errorTextCentered
[bool
]
optional
This parameter sets whether any error text will be displayed center aligned in the scratchpad, if blank it will display the same as normal text. By default this is false.
clearScratchpadOnError
[bool
]
optional
This parameter sets whether any text which is already contained in the scratchpad will be cleared when an error is displayed. This is false by default.
Example options interface from the WT21:
private static SCRATCHPAD_OPTIONS: Partial<FmcScratchpadOptions> = {
renderRow: 13,
cellWidth: 24,
clearScratchpadOnError: true,
deleteText: 'DELETE',
errorTextCentered: true,
surroundingText: ['__LSB[blue]', '__RSB[blue]'],
};