Single line input element behavior with mask.
Example, telephone number input element:
<input type="masked" mask="( ### ) ### - ####" />
<input type=“masked”>
that have this behavior applied by default (see master_style_sheet):
<input type=“mask” /> - inline single line <widget type=“mask”></widget> this behavior knows about:
value=“text” - initial value of the input element.mask=“text” - input mask string. Characters with the special meaning in the string:# - decimal digit position.0 - decimal digit position, the whole group is represented as a number with leading zeroes._ - alphabetic character or digit position.@ - alphabetic only character position.Together with the standard set of events (mouse, keyboard, focus) behavior: button generates:
Value of element with this behavior assigned is either one:
Edit supports following xcall() methods (see dom::element::xcall() function):
xcall(“copy”, false): bool - returns true - if copy is available and false if not;xcall(“copy”, true) - executes copy operation - copy selection into the clipboard;xcall(“paste”, false): bool - returns true - if paste is available and false if not;xcall(“paste”, true) - executes paste operation - pastes content of the the clipboard;xcall(“selectAll”): bool - returns true if current selection spans the whole document and false otherwise. xcall(“selectAll”, true) - selects whole content of the editor;xcall(“mask”, maskDefinition) - sets extended mask. mask definition here is an array of the following:”…” - literal string, defines non-editable text;[“item1”,”item2”, …] - vector of strings, editable enumeration field. By using UP/DOWN keys user is able to select needed value. On character key the behavior will try to find item that starts from that character.type=“integer” - type of the editor for the field;width=n - integer, number of characters in the field;min=n - integer, optional, min value of the field;max=n - integer, optional, max value of the field;leading-zero=true - boolean, optional, true will prepend the value by zeroes; type=“text” - type of the editor for the field;width=n - integer, number of characters in the field;filter=… - optional, string, defines characters allowed in the field, e.g. filter “0~9” will allow only numeric characters in the field.Here is an example of defining extended mask in Sciter:
var edit = self.select("input#ip-address");
const ipmask = [
{ type:"integer", width:3, min:0, max:255, #leading-zero:true }, ".",
{ type:"integer", width:3, min:0, max:255, #leading-zero:true }, ".",
{ type:"integer", width:3, min:0, max:255, #leading-zero:true }, ".",
{ type:"integer", width:3, min:0, max:255, #leading-zero:true } ];
edit.mask(ipmask);