TextField::CreateForElement(..., ..., formatter, ...) works fine for my Item Type properties that store text. I don't need to supply a formatter (i.e. formatter is nullptr) for the text to be displayed correctly.
TextField::CreateForElement(..., ..., formatter, ...)
formatter
nullptr
I have recently added a Boolean Item Type property. The default formatter for Boolean shows text True or False. How do I write a formatter to display, say, Yes or No?
Jon, take a look at BooleanClass in MstnPropertyFormatter schema.
Specifically the "BoolWord" property supports the following integer values; a value of 2 will format a boolean as "Yes" or "No".
<ECClass typeName="BooleanClass" isDomainClass="True"> <BaseClass>FormatterBaseClass</BaseClass> <BaseClass>VariableBindingClass</BaseClass> <ECProperty propertyName="BoolWord" typeName="int" displayLabel="Display As"> <ECCustomAttributes> <StandardValues xmlns="EditorCustomAttributes.01.00"> <ValueMap> <ValueMap> <Value>0</Value> <DisplayString>(Default)</DisplayString> </ValueMap> <ValueMap> <Value>1</Value> <DisplayString>True/False</DisplayString> </ValueMap> <ValueMap> <Value>2</Value> <DisplayString>Yes/No</DisplayString> </ValueMap> <ValueMap> <Value>3</Value> <DisplayString>On/Off</DisplayString> </ValueMap> <ValueMap> <Value>4</Value> <DisplayString>Enabled/Disabled</DisplayString> </ValueMap> </ValueMap> </StandardValues>
Answer Verified By: Jon Summers