Removing some of the elements that are not needed when they are shown in a combo-box on a form.To achieve this behavior Microsoft has given a class just for that purpose. The class is “SysFormEnumComboBox”.
Here is a sample code snippet that depicts how to use this class on a form having a combo-box control:
Simply override the init() of the form and add the code.
{
SysFormEnumComboBox sysFormEnumComboBox;
Set enumSet = new Set(Types::Enum); // collection of selected values.
enumSet.add(HMDaysName::Monday);
enumSet.add(HMDaysName::Wednesday);
enumSet.add(HMDaysName::Friday);
SysFormEnumComboBox = SysFormEnumComboBox::newParameters(element, element.controlId(formControlStr(TestForm, ComboBoxCtrl)), enumName2Id(enumStr(HMDaysName)), enumSet,"Select");
super();
SysFormEnumComboBox.select(HMDaysName::Friday); // To select value in combo
}
No comments:
Post a Comment