Hello,
We have a client side remote object and we are attaching event handler to a text control on mouseUp event. However, the setSelection() on the text widget doesn't seem to be updating the selection based on the cursor placement. We need to set the selection from the current cursor position to the end of the text.
It seems to work fine and updates the selection when we move the cursor to the left of the current position but doesn't update when we move the cursor to the right of the current position. Logging out widget.getSelection()[0] doesn't seem to give the right value. This seems to work fine in SWT/RCP with widget.getSelection().x.
Here is the code which we have on the client side JS:
onMouseUp(event) {
const widget = event.widget;
widget.setSelection([widget.getSelection()[0], widget.getText().length]);
}
We have also tried giving a using the timeout function to trigger it later but that suffers from the same problem:
setTimeout(function() {
widget.setSelection([widget.getSelection()[0], widget.getText().length]);
}, 0);
Any suggestions/recommendations would be appreciated.
Thanks.
[Updated on: Wed, 05 February 2020 17:07]
Report message to a moderator