[Solved] Text Formatting in text control?
I have a lua made control:
Code:
page = WINDOW_MANAGER:CreateControlFromVirtual("someparent", someplace, "ZO_DefaultEditMultiLineForBackdrop") To clarify, I have no issue setting the text color for the control. I want "|cFF0000TEXT|r" to show "TEXT" with the color. Just like in other text controls in the game. Any clues? |
only valid control function are here:
http://wiki.esoui.com/Controls#EditControl because your reference is an edit control: ZO_DefaultEditMultiLineForBackdrop as far i see, ZOS running like this: xml Code:
in the inherit there is ZO_EditDefaultText: DescriptionBodyFieldText:SetColor(1,1,1,1) maybe this works for the lua too: page = WINDOW_MANAGER:CreateControlFromVirtual("someparent", someplace, "ZO_DefaultEditMultiLineForBackdrop ZO_EditDefaultText") pageText:SetColor(1,1,1,1) ? |
Quote:
To clarify, I have no issue setting the text color for the control. I want "|cFF0000TEXT|r" to show "TEXT" with the color. Just like in other text controls in the game. |
Quote:
|
Quote:
Hrm. I saw that the game in the guild window in MOTD uses a ZO_SavingEditBox(): http://esodata.uesp.net/current/src/...rd.lua.html#25 I wanted to replicate that behavior, but trying different templates, none of them did. So, you're saying the game replaces the editbox with a label for this need? I don't see it in the code. |
The ZO_ScrollingSavingEditBox is a highly complex object that combines several controls and uses lua code to achieve the behavior you see with the MotD. You cannot replicate it just by letting an edit box control inherit its template. Instead you'd have to use it as seen in the code for the guild MotD.
I'd also recommend you look at the source code extract on github, since UESP doesn't seem to include the xml files. |
Quote:
Your advice to check the .xml on github really helped. I saw that it is the case they just use 2 controls, one for edit and one for display, and switch them. I did just that, and now it works as expected. :) Just toggle SetHidden and TakeFocus OnMouseUp if upInside and reverse OnFocusLost. Thanks for helping! Saved me on this one. |
In the next major version edit boxes will have the XML attribute "escapeMarkup" which you can set to false to achieve this.
|
Quote:
Exactly what I was wondering. :D Toggles make life easy. Thanks dev. |
Quote:
EDIT: Just ran into ShouldEscapeMarkup() which does just that, but goes off tradition. :P Funny. Also, testing this new function, it doesn't update the display immediately. The old solution that toggles hiding between an Editbox and Label works immediately, which means they're not interchangeable yet. Thanks for the great work! |
All times are GMT -6. The time now is 06:19 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI