Download

While OnTextCommit is running, it can trigger again, if you're not debugging the Blueprint (Inconsistent?)

Hi,
Ok this took me some time to figure out properly. Someone modified the code for our chatbox and it stopped working. So I looked into it. What you see in this Pic, is the beginning of our Eventhandler for the OnTextCommit event. At runtime, when the user focuses the Textedit, we add ourself to the eventhandler. When we’re done, we remove us again from within our handler (not visible in this pic).

We only handle the text if it is committed by pressing enter, in all other cases we discard it.
What’s happening here is, that when a user commits by pressing enter, the first thing that’s called is “SetFocusToGameViewport”. This, however, triggers the OnCommit event again(!). But this time with “Default” as commit method. The second, recursive, run then discards the text in the edit and unbinds the handler from the event. Unbinding the event handler seems to get it deactivated, as the original one with OnEnter is not progressing anymore.

The horrible thing is, placing a breakpoint on the start of the eventhandler will let you step through it in the expected way. Removing the breakpoint will let it run the event recursively.

So it seems, that either the event should not trigger recursively or it should behave the same with the BP debugger as it does without it.

Has this changed? We’re running 4.24 right now. Maybe there was a fix for this behavior. Either way is fine, as long as it’s consistent.