LuaGuiElement(text-box)::selection

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

LuaGuiElement(text-box)::selection

Post 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
Attachments
preview.png
preview.png (40.04 KiB) Viewed 1046 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

cyfrov
Inserter
Inserter
Posts: 25
Joined: Thu May 03, 2018 7:09 pm
Contact:

Re: LuaGuiElement(text-box)::selection

Post 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

User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Re: LuaGuiElement(text-box)::selection

Post 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
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

Post Reply

Return to “Modding interface requests”