Monday, June 02, 2008

Giving Colors to ComboBox values according to selection

1. Select the combobox control and set the property ColorScheme as RGB
2. then add the following codes in the modified method of the control
for example : i use a enum type ABCModel.(give some integer values for the foreground)
public boolean modified()
{
boolean ret;
ABCModel aBCModel;
;

ret = super();

switch( Str2Enum(aBCModel, ComboBox.valueStr()) )
{
case ABCModel::ContributionMargin :
ComboBox.foregroundColor(255);
break;

case ABCModel::Link :
ComboBox.foregroundColor(-400);
break;

case ABCModel::Revenue :
ComboBox.foregroundColor(100);
break;

case ABCModel::Value :
ComboBox.foregroundColor(156);
break;
}
return ret;
}

No comments: