Announcement

Collapse
No announcement yet.

Multi-line TextBox, weird commit behaviour

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Multi-line TextBox, weird commit behaviour

    Hello, I'm messing with a chat system, and right now my problem is that the TextBox's OnTextCommitted event does not get called on Enter. It is called however when the TextBox loses focus.
    OnTextChanged event works fine though.

    I've seen other posts with the same problem, never to be solved.

    Click image for larger version

Name:	Capture.PNG
Views:	236
Size:	55.5 KB
ID:	1598752

    #2
    This is "unsolved" because it isn't a bug/issue, and this behavior is not weird. I'm sure it has been frustrating, and appears to be an issue/bug from your angle, but multiline textboxes do not commit on hitting "enter" on the keyboard as that is how you drop to a new line. This is intended functionality for a very broad spectrum of multiline textboxes, not just in UE4. In filling out your post here in the discussions, for example, you hit enter multiple times. If it had posted the second you hit enter (instead of adding a newline), would that have been satisfactory? Probably not. Keep this in mind with your game's UX.

    To modify the behavior, you can easily handle the pressing of enter as a commit, and the pressing of shift + enter as adding a new line. Basically, if shift + enter is pressed, we do nothing (thus allowing regular functionality -- a new line -- to carry out). If enter is pressed, we handle it as a commit. See here:

    https://answers.unrealengine.com/que...e-textbox.html

    This example is rudimentary, and in your position I'd also want to make absolutely sure the multiline textbox is focused as well (in case you'd ever want enter to do something else, like traverse a menu, save, etc.). However, it does show an example of working through exactly what you're attempting, and gives a great starting point.
    Last edited by One Mode Only; 03-25-2019, 12:14 PM.

    Comment


      #3
      Thanks for the answer.
      I get what you mean. This is why it's confusing

      Click image for larger version

Name:	Untitled.png
Views:	219
Size:	48.1 KB
ID:	1598884

      Now I get that it's just a generic message not specific to this widget.

      Comment


        #4
        Agreed, the verbiage could definitely use an update to reflect that this will not take place in a multiline textbox.

        Comment

        Working...
        X