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
LuaGuiElement(text-box)::selection
LuaGuiElement(text-box)::selection
- Attachments
-
- preview.png (40.04 KiB) Viewed 1228 times
Last edited by ownlyme on Sat Apr 20, 2019 11:24 am, edited 1 time in total.
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
Re: LuaGuiElement(text-box)::selection
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
i.e. as a player is typing, filter out all non-numeric characters
+1
Re: LuaGuiElement(text-box)::selection
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
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
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance