input
The input class provides an interface to manage properties and actions of input widgets.
Hierarchy
ℹ️ Important
- This class inherit from the
scrollableclass - All functions that return
Thisreturn the current widget object and can include one call after another.
This class is available via the form class through the Input interface.
Example
This.form:=cs.form.new(This)
...
This.myInput:=This.form.Input("myWidget")
...
This.myInput.asPassword:=True
This class is, more generally, available from the cs class store, or cs.ui class store if you use the UI component.
Example
Form.myInput:=cs.ui.input.new("date")
Form.myInput.filter := Is date
cs.input.new()
cs.input.new ( name : Text) : cs.input
cs.input.new ( name : Text ; parent : Object) : cs.input
cs.input.new ( ) : cs.input
| Parameter | Type | Description | |
|---|---|---|---|
| name | Text | → | Widget name |
| parent | cs.form | → | form object containing the widget |
| result | cs.input | ← | New cs.input |
Description
cs.input.new() creates & returns a new instance of the class.
- The optional
parentparameter is thecs.formobject containing the widget. This parameter is automatically set if instantiation is performed via a form widget instantiation function of thecs.formclass. - If the
nameparameter is ommited, the constructor use the result of OBJECT Get name (Object current )
⚠️ Omitting the widget name can only be used if the constructor is called from the object method.
Properties & Functions
Inherited properties and functions are described in the parent classes:
Properties
| Properties | Description | Type | default | Writable |
|---|---|---|---|---|
| .asPassword | Treat input as password entry if True | Boolean |
False | ✓ |
| .autoSpellcheck | Auto spellcheck option for the widget | Boolean |
- | ✓ |
| .dictionary | Current dictionary **** | Object |
- | |
| .filter | Modify the entry filter | Integer* | Text |
- | ✓ |
| .modified | Modified state of the field since the backup() function was called*** |
Boolean |
False | x |
| .placeholder | The placeholder text | Text** |
- | ✓ |
Functions
| Functions | |
|---|---|
| .backup () | Stores the current input value*** |
.getFilter () → Text |
Returns the current filter associated with the widget if any. |
.highlight ({start {; end }}) → This |
Highlights: * All text if no parameters are passed * From start to the end of the text if the end parameter is omitted* From start to end if start & end are passed |
.highlighted () → Object |
Returns the selection status of the field as a selection object. |
.highlightingEnd () → Integer |
Returns the end position of currently selected text |
.highlightingStart () → Integer |
Returns the start position of currently selected text |
.highlightLastToEnd () → This |
Highlights the text from the last character entered to the end |
| .restore () | Restores saved widget value |
.setFilter ( integer* {; decimalSep }) → This.setFilter (text ) → This |
Sets the entry filter for the widget. |
.setPlaceholder ( Text**) → This |
Sets the placeholder text |
| .swapDecimalSeparator () | Replace the point by the decimal parameter in a text box Must be called during management of the On Before Keystroke event |
| .truncateWithEllipsis ({where {; target {; char }}}) | Truncate label with ellipsis or char, according to the widget current width.where can be: Align left, Align right or Align center (default) |
* Use 4D constants (possible values : Is integer, Is longint, Is real, Is time or Is date) for default predefined formats or pass the filter definition as text. Some predefined filters name are available: "url", "email", "noCr", "noSpaceNorCr"
** Accepts an xliff resname, if so, uses the localized string
*** If the widget is instantiated by the Input interface of the form class, a backup is automatically made during execution of the form.onload() handler.
**** When you read the dictionary property is an object
Form.input:=cs.input.new({"input"})
$dictionary:=Form.input.dictionary
{
id: (Integer),
code: (Text),
name: (Text)
}
When you write, you pass the id or the code or the name
Form.input.dictionary:="fr"
If the dictionary is not installed, an assert is triggered.
Selection object
{
start: $start;
end: $end;
length: $end-$start; \
withSelection: $end#$start;
noSelection: $end=$start;
selection: ""
}