Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Clearing Editable Textbox

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

Product Version: UE 4.19
more ▼

asked Jun 25 '18 at 03:18 AM in Blueprint Scripting

avatar image

26 2 3 7

avatar image HarryHighDef Jun 29 '18 at 08:41 AM

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.

avatar image Myscelus Jun 29 '18 at 03:04 PM

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

avatar image Naitguolf Nov 26 '18 at 11:12 AM

Thank you! That solved my problem!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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

more ▼

answered Jun 25 '18 at 03:47 AM

avatar image

724 10 8 13

avatar image Myscelus Jun 25 '18 at 06:17 AM

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.

avatar image vivalabugz Jun 26 '18 at 05:59 AM

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. alt text

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

  • 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. alt text

  • 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. alt text

  • 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: alt text

textbox-menu.jpg (214.3 kB)
textbox.jpg (209.9 kB)
screenshot-41.png (285.6 kB)
textbox.gif (3.5 MB)
avatar image Myscelus Jun 26 '18 at 07:32 PM

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.

avatar image vivalabugz Jun 27 '18 at 07:49 AM

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?

avatar image Myscelus Jun 28 '18 at 12:26 PM

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.

avatar image vivalabugz Jun 28 '18 at 06:30 PM

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!

avatar image Myscelus Jun 29 '18 at 02:14 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question