Actually. @Deltakosh . Is there a way to get the location of the caret cursor, and insert text/delete text before or after the cursor? I tried looking in the source, but you might know an immediate quick solution. The use case is that webxr quest keyboards fully erase whatever is in the document text object, so i want to manually implement adding text on the TextInputArea at cursor location.
Hello @jdtokyo
I’m with you on this (the need to have a public method to set caret position).
I remember that I had some issues for my Chat Project (Online chat 100% based on BJS GUI)
Having a look back to my code, I get to this :
// Goal is to put Input Caret at the end (only private)
// https://forum.babylonjs.com/t/set-input-caret-position/32778/3
function triggerArrowDown() {
let evt = new KeyboardEvent('keydown', {
key: 'ArrowDown',
code: 'ArrowDown',
keyCode: 40,
which: 40,
bubbles: true,
cancelable: true,
view: window
});
canvas.dispatchEvent(evt);
}
Funny enough, the comment even contains a topic of this forum that I had in mind to come back to :