UiTextInputBus strange behavior

0

Guys, since version 1.8 I have seen this issue but I am not sure if I am using this bus correctly.

Whenever I call UiTextInputBus.Event.SetText(entId, str), the text string is placed in the input field but it does not show up.

The only way to make it appears is to have a whitespace in the field before I call it. But for fields that the user is editing is a little bit annoying because I have to track all the events to left a whitespace there.

What am I doing wrong?

Tks!

asked 7 years ago160 views
7 Answers
0
Accepted Answer

Thanks @REDACTEDUSER

In the meantime, you can fix this by adding the following line to UiTextInputComponent.cpp:

m_childTextStateDirtyFlag = true;

Add that line to the following functions (at the beginning is fine):

void UiTextInputComponent::SetText(const AZStd::string& text)
void UiTextInputComponent::SetTextEntity(AZ::EntityId textEntity)
void UiTextInputComponent::SetPlaceHolderTextEntity(AZ::EntityId textEntity)
answered 7 years ago
profile picture
EXPERT
reviewed 10 months ago
0

Hi @REDACTEDUSER

textEntity = UiTextInputBus.Event.GetTextEntity(textInputEntityId)
UiTextBus.Event.SetText(textEntity, "Hello world!")

Here are the Lua script reference pages for UiTextInputBus and UiTextBus:

http://docs.aws.amazon.com/lumberyard/latest/developerguide/lua-scripting-ces-api-ui-uitextinputcomponent.html

http://docs.aws.amazon.com/lumberyard/latest/developerguide/lua-scripting-ces-api-ui-uitextcomponent.html

Hope that helps!

answered 7 years ago
0

Apologies - I actually didn't realize there was a SetText method directly available on the UiTextInputBus. I'll look into this a little more to see what's going on!

answered 7 years ago
0

I think there's an issue with how the text input component updates when its text element value changes. I'm investigating this and will update once I have more information!

answered 7 years ago
0

tks! it is working!

answered 7 years ago
0

Great! Thank you for confirming that it's working for you now. We'll include that fix in a future release.

answered 7 years ago
0

Fixed in 1.12, thanks.

answered 6 years ago

This post is closed: Adding new answers, comments, and votes is disabled.