UI/Frame Types/TextFormatFrame

From SC2Mapster Wiki
Jump to: navigation, search

TextFormatFrame

This is utility frame, that doesn't display anything by itself. It's purpose is to assemble a text, from a list of tokens provided in Replacement list, using a pattern specified in FormatText.

Assembled text is stored in a Text property (read-only). Which can be bound to property of another frame, such as Text in Label.

Structure

N/A

TextFormatFrame Properties

TextFormatFrame inherits from Frame and shares all of its properties. Additionally it has:


FormatText
This value contains a string of text with marks (%#%) of indexes for string replacement.


Text
This value contains a string of text.


Replacement
This value contains a string of text to replace an index in a FormatText string (%#%) with.


RequiredReplacements
This value is the number of replacements required for the FormatText to be displayed, otherwise the Text field will be left blank.

Examples

<Frame type="TextFormatFrame" name="TestTextFrame">
	<Anchor relative="$parent" />
	<FormatText val="Testing Testing %0% %1% %2% ..."/>
	<Replacement index="0" val="A"/>
	<Replacement index="1" val="B"/>
	<Replacement index="2" val="C"/>
</Frame>
<Frame type="TextFormatFrame" name="ShieldsText">
    <Anchor relative="$parent"/>
    <FormatText val="%0% / %1%"/>
    <Replacement val="{$parent/HealthValues/@Shields}" index="0"/>
    <Replacement val="{$parent/HealthValues/@MaxShields}" index="1"/>
</Frame>
<Frame type="Label" name="FenixCurrentShields">
    <Text val="{$parent/ShieldsText/@Text}"/>
</Frame>