Page 1 of 1

LuaGuiElement(text-box)::selection

Posted: Fri Apr 19, 2019 12:24 pm
by ownlyme
Currently there is no way to figure out where the text cursor is (when the text-box has changed)
It's nice that you added the parameter select(start, end) and that it's able to set the cursor by using select(index+1,index), but it's still missing a way to read the current position to create a fully-featured ingame text editor (what i'm doing right now)
You could iterate the text and look for changes, but for example when the string is aaabbb and you insert another a, you can't tell at what position the a has been inserted because the change would happen at the transition to the b's

Re: LuaGuiElement(text-box)::selection

Posted: Sat Apr 20, 2019 2:48 am
by cyfrov
This would be nice, can certainly allow for text field validation:
i.e. as a player is typing, filter out all non-numeric characters

+1

Re: LuaGuiElement(text-box)::selection

Posted: Sat Apr 20, 2019 11:38 am
by ownlyme
in your example you could still find the cursor position because there would be a transition from letters to digits
i guess in my case i could simply not update the textbox when theres a transition near dublicate characters... but its still far from optimal