Skip to main content

History: MyGUI text formatting

Source of version: 3 (current)

Copy to clipboard
            {maketoc}

MyGUI support several special sequences in text fields.
!!!Constantly applied formatting
This sequences checked any time when text is changed:
* __"#rrggbb"__ ([http://www.w3schools.com/Html/html_colors.asp|html hex colour]) - changes text colour until end of text or new colour sequence.
* __"##"__ - '#' character.
!!!Replaced at load time sequences
This sequences are replaced only when applied to widget through setProperty (for example when loaded from layout):
* __"\n"__ (two characters, not C/C++ escape character) - replaced with new line character, so in text file you can type "\n" and it will be replaced with new line.
* __"#{Keyword}"__ - this will be replaced with some string defined in language file or added to LanguageManager in runtime. If no replaced found than sequence kept unchanged. See MyGUI::LanguageManager interface for more details.

!!!Usage in runtime
* When you use copy and paste in Edit widget text is copied with it's colour, or default colour added if there was no colour tag;
* getCaption() return text __with __special sequences like colour sequence;
* getOnlyText() return text __without __special sequences like colour sequence, also this return actual text, typed in Edit with Password mode enabled.

!!!Examples
||__Original text__ | __Visible text__
This text is #00ff00green | This text is ~~#0F0:green~~
#00ff00green and #ff0000red text | ~~#0F0:green and~~ ~~#F00:red text~~
Sometimes long text\nis splitted manually| Sometimes long text{DIV(class="123")}{DIV}is splitted manually
Message box with #{MyGUI_MessageBox_Cancel} button{DIV(class="123")}{DIV}''(LanguageManager language is English)''| Message box with Cancel button
Message box with #{MyGUI_MessageBox_Cancel} button{DIV(class="123")}{DIV}''(LanguageManager language is Russian)''| Message box with Отмена button
#{UnknownKeyword} in string | #{UnknownKeyword} in string||