Fixed input for sets (fix #112)

This commit is contained in:
Pieter Vander Vennet 2020-09-11 00:23:19 +02:00
parent e0f2f70c2e
commit 3653c3ecaa
3 changed files with 34 additions and 30 deletions

View file

@ -224,8 +224,22 @@ export class TextField<T> extends InputElement<T> {
}
public SetCursorPosition(i: number) {
const field = document.getElementById('text-' + this.id);
if(field === undefined || field === null){
return;
}
if(i === -1){
// @ts-ignore
i = field.value.length;
}
field.focus();
// @ts-ignore
field.setSelectionRange(i, i);
}
IsValid(t: T): boolean {
if(t === undefined || t === null){
if (t === undefined || t === null) {
return false;
}
const result = this._toString(t);