context method in ax 2012 code example

Example: context method in ax 2012

public void context()
{
int selMenu,id;
DictEnum dEnum= new DictEnum(enumName2Id('TemplateEnum'));
PopupMenu menu;
menu = new PopupMenu(element.hWnd());
 
for(id=0; id<=dEnum.values()-1;id++)
{
 
menu.insertItem(dEnum.value2Name(id));
}
 
selMenu = menu.draw();
 
switch(selMenu)
{
 
case enum2int( TemplateEnum::Doctor) +2:
Template_Text.text(Template_Text.text()+enum2str(TemplateEnum::Doctor));
break;
 
case enum2int( TemplateEnum::Patient) +2:
Template_Text.text(Template_Text.text()+enum2str(TemplateEnum::Patient));
break;
 
case enum2int( TemplateEnum::Visiter) +2:
Template_Text.text(Template_Text.text()+enum2str(TemplateEnum::Visiter));
break;
}
}

Tags:

Misc Example