Hi,
Let me question how to wrap text in Verse,
I wrote the following code to show text inside widget:
AddWidget(Agent : agent, Title : string, Msg : string) : void=
if:
Player := player[Agent]
PlayerUI := GetPlayerUI[Player]
then:
MessageWidget := CreateWidget(Title, Msg)
InputMode := player_ui_slot:
InputMode := ui_input_mode.All
PlayerUI.AddWidget(MessageWidget, InputMode)
if:
set widgetMap[Player] = MessageWidget
CreateWidget(Title : string, Msg : string) : canvas=
var btn : button_quiet = button_quiet{DefaultText := StringToMessage("CLOSE")}
btn.OnClick().Subscribe(RemoveWidget)
....
canvas_slot:
Anchors := anchors{Minimum := vector2{X := 0.5, Y := 0.5}, Maximum := vector2{X := 0.5, Y := 0.5}}
Offsets := margin{Left := -900.0, Top := 195.0, Right := 500.0, Bottom := 210.0}
Alignment := vector2{X := 0.0, Y := 0.0}
SizeToContent := false
Widget := text_block:
DefaultText := StringToMessage(Title)
DefaultTextColor := NamedColors.White
.....
return MessageWidget
However, the text is sticked out of the widget.
as this picture shows:
How shoud I do to wrap text to fit into the widget?
(Using “\n” for each sentence takes much time. So, I would like to know whether text can be wrap automatically setting “text_block”)
Regards