You can specify the background color for a cell in the Feature Chooser by
adding a new string attribute to its VolatileInstance object and naming
it as <AttributeName>_BackgroundColor.
Similarly, you can manage the text color of the cells in the feature
chooser by adding a new string attribute and naming it as
<AttributeName>_TextColor.
Here, AttributeName is the name of the attribute whose
cell is to be colored. Its value range is as per RGB (Red, Green, and
Blue) color value, for example, between 0-255.
The following is an example of On Init action, listing volatile instance
representing musicians:
// Create a list containing some info on a few musicians.
let lMusicians (List)
lMusicians = List(
List( "Herbert Jeffrey", "Hancock", "Herbie Hancock", "M", "USA", "Piano" ),
List( "Philip David Charles", "Collins", "Phil Collins", "M", "England", "Drums" ),
List( "Candy", "Dulfer", "Candy Dulfer", "F", "Netherlands", "Saxophone" )
)
let m (Integer)
let lMusicianInfo (List)
let Instrument, IconInstrument(String)
let ColorInstrument (String)
let TextColorInstrument (String)
m = 1
TextColorInstrument = "255,255,0"
for m while m <= lMusicians.Size()
{
// Accessing info for each musician.
lMusicianInfo = lMusicians[m]
// Creating a volatile instance for each list in lMusicians.
let aMusician (VolatileInstance)
aMusician = new( "VolatileInstance", "Musician", NULL )
// Adding attributes to the volatile instance.
aMusician.SetAttributeString( "Firstname", lMusicianInfo[1] )
aMusician.SetAttributeString( "Lastname", lMusicianInfo[2] )
aMusician.SetAttributeString( "StageName", lMusicianInfo[3] )
aMusician.SetAttributeString( "Sex", lMusicianInfo[4] )
aMusician.SetAttributeString( "Country", lMusicianInfo[5] )
// Access the Instrument played by the musician: it is the 6th element of each list of the list.
Instrument = lMusicianInfo[6]
// Set the icon to display in front of the instrument.
if Instrument == "Piano"
{
IconInstrument = "Piano"
ColorInstrument = "255,0,0"
}
else if Instrument == "Drums"
{
IconInstrument = "Drums"
ColorInstrument = "0,255,0"
}
else if Instrument == "Saxophone"
{
IconInstrument = "Saxophone"
ColorInstrument = "0,0,255"
}
else
{
IconInstrument = " "
ColorInstrument = "0,0,0"
}
aMusician.SetAttributeString( "Instrument", Instrument )
aMusician.SetAttributeString( "Instrument_Icon", IconInstrument )
aMusician.SetAttributeString( "Instrument_BackgroundColor", ColorInstrument )
aMusician.SetAttributeString( "Instrument_TextColor", TextColorInstrument )
// Appending this musician (VolatileInstance) to the list plugged to the feature chooser.
lMusicians_as_VolatileInstances.Append( aMusician )
}