MyGUI text formatting        

MyGUI support several special sequences in text fields.

Constantly applied formatting

This sequences checked any time when text is changed:

  • "#rrggbb" (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 green
#00ff00green and #ff0000red text green and red text
Sometimes long text\nis splitted manually Sometimes long text
is splitted manually
Message box with #{MyGUI_MessageBox_Cancel} button
(LanguageManager language is English)
Message box with Cancel button
Message box with #{MyGUI_MessageBox_Cancel} button
(LanguageManager language is Russian)
Message box with Отмена button
#{UnknownKeyword} in string #{UnknownKeyword} in string