|
Re: Select contents on start edit of input field [message #1858219 is a reply to message #1858126] |
Thu, 23 March 2023 10:31 |
|
Hi Nils,
there is no such functionality. You could add it by extending the StringField.ts (and NumberField.ts), override _render() and add a listener, e.g.:
import {StringField} from '@eclipse-scout/core';
export class CustomStringField extends StringField {
protected override _render() {
super._render();
this.$field.on('click', event => this.$field[0].select());
}
}
This will always select all text, so the user won't be able to select only a part of the text, which is probably not ideal. You could use a mouseup listener instead of a click listener and do it only if the selection has not been changed or something like that.
See Extension by Sub-Classing for details about how to extend the StringField. If you only want specific StringFields to behave like that, you could use a @ModelVariant and add it to your Java StringField (e.g. @ModelVariant("yournamespace.Custom"). Or you could add a custom property and only register the listener when the property is true. That would require to extend StringField.java, JsonStringField.java and StringFieldAdapter.ts as well.
|
|
|
|
Powered by
FUDForum. Page generated in 0.01694 seconds