Clearing Editable Textbox

Have you tried a “Set text” node? You should use a set text and leave it blank after clicking for the first time

So I’ve just hit a minor roadblock which is mostly just a decorative problem, But there doesn’t appear to be any way to clear a textbox upon clicking on it. I tried wrapping it with a button but unfortunately it didn’t work due to it also having clickable surface.
Does anyone know the secrets of editable textboxes or will I just have to find another way?

For more information, I’m using it to create save files. I could have the box empty and place text somewhere else to inform the player but surely there is a way…

Set text would be fine but there’s no event to tie it to.
Editable textboxes only support events on edit/commitment of change.

Also just in case anybody reads this searching for extra info on these textboxes, The commit event triggers twice unless you handle it properly, It’ll trigger once on focus lost and once on pressing enter. So pressing enter will do both as it drops focus when pressed.

EDIT: It just occurred to me I never actually checked what the edit event actually does… Perhaps by edit it means just focusing it. Else what would be the point of having two events that do the same…

Update: Not surprisingly still not useful for my problem.

Sorry for the delayed response but I was able to figure it out. Heres how I got it:

  • I created a widget that is my “menu” without the editable text box.

  • Next, I created another widget for the editable text box. Make sure the box is set as a variable

  • Now in the editable text box widget, in the override functions, select On Added to Focus Path and add a set text node to that.

  • In my textbox menu BP I created the textbox widget on construct and added the widget as a child to my menu widget, specifically the horizontal box.

  • In my level BP a created the menu widget on begin play, added it to the viewport, set the game input mode Game and UI, and set show mouse cursor to true.
  • Here’s how it turned out:

245426-textbox.gif

1 Like

Oh, I didn’t even consider overrides.
That’s exactly what I was trying to do.

Thanks vivalabugz.

EDIT: I couldn’t actually get it to work how I wanted. I’d have needed to copy half of my code for the main widget into it to get it to work how I wanted. I did managed to find a solution that was n behavior settings. Select all text on focus.

I’m assuming you set select all text to true? How were you able to delete the text after it selects it all without pressing a key?

Yeah I set it to select all. I didn’t make it delete the text, but as the player types in anything it’ll delete it anyway because its all selected.
Would’ve preferred to get your solution to work but honestly I kinda hit a wall with it. My scroll box wasn’t sorting it in any way at all despite using the exact same nodes I used for creating multiple buttons for loading save data.

So I tried getting the editable textbox focus thing to work in my main widget but it turns out that focus node is widget wide and there is no individual like that. I thought maybe going from buttons to widgetswitcher+box/editable would trigger it but it doesn’t.

Through trying to sort all that out I found another bug in my loading lists of gamesaves though so more knowledge gained at least.

The reason I made the textbox its own widget was because I assumed the focus was for the widget it was being called on. I havent tested it with more than one. Maybe you could try using a grid panel and adding textboxes to your grid as a way to sort them out, if Im understanding you right.

Anyway, glad I could help!

Yeah, I’m not entirely sure why the scrollbox didn’t want to line it up the textbox as it did with my save widgets, maybe there’s some kind of issue with adding different widget types into a scroll box through your widget in the first place. Honestly it’d probably take me days of playing around with it to work out why it was being weird.
Grid probably would fix the issue but there shouldn’t have been one in the first place.
Anyway, Thanks for the ideas. Perhaps I can get it working at a later date.

Can you not just use the hint text?

If its for a file name then when you get the text from the box just use a default if it has no text.

…Boy do I feel stupid… Viva even used hint text when he was helping… Didn’t even noticed because other problems.

Thank you! That solved my problem!