I want to confirm if this is a bug or if I’m just doing something wrong. There’s two issues here actually.
Here’s how I’m setting up my ScrollView:
_scrollview_chat = chatContainer->CreateChild<Urho3D::ScrollView>();
_scrollview_chat->SetStyleAuto();
_scrollview_chat->SetFocusMode(Urho3D::FM_NOTFOCUSABLE);
_scrollview_chat->SetEditable(false);
_scrollview_chat->SetSize(chatContainer->GetWidth(), chatContainer->GetHeight() - 24);
_scrollview_chat->SetPosition(0, 0);
Urho3D::UIElement* chatContentElement = _scrollview_chat->CreateChild<Urho3D::UIElement>();
_scrollview_chat->SetContentElement(chatContentElement);
chatContentElement->SetLayoutMode(Urho3D::LM_VERTICAL);
chatContentElement->SetStyleAuto();
chatContentElement->SetPosition(0, -12);
chatContentElement->SetAlignment(Urho3D::HA_LEFT, Urho3D::VA_BOTTOM);
Here’s how I add a message:
Urho3D::Text* text = _scrollview_chat->GetContentElement()->CreateChild<Urho3D::Text>();
//text->SetWordwrap(true);
text->SetFont(font, 12);
text->SetText(sender + ": " +message);
The first issue that I’m experiencing is that the scrollbar doesn’t properly work with the alignment VA_BOTTOM. Elements populate bottom-to-top as they should, but the scrollbar still expands from the top instead of the bottom.
I’ve included some screenshots showing the behavior here: imgur.com/a/ywDZn
My second issue is that word wrap does not work properly. In the above code, I’ve uncommented the following:
text->SetWordwrap(true);
However what this does is cause the text not to appear entirely. The length of the text causes the height of the scrollview content element to become very tall, indicating that it is likely wrapping the text to be 1 character wide.