Passing Parameters to Menu Item

maria_iva81
Member Posts: 39
How can i pass parameters(possible values from BaseEnumType) to MenuItems so that later according to the value to activate different Report....Please help
0
Comments
-
It looks like you are very new to Axapta.. Try reading the following topics in Ax. Developer guide:
1. Description of properties for menu items
2. Activating a menu item from your X++ code
and about the Args class under AOT\System documentation\Classes.
Good luckKind regards,
Ciprian Dudau
Axapta Developer0 -
I start reading now and you are right its been only 2 weeks with Axapta
If there are any problems later than i'll post them. Once again thank u
))
0 -
Soory but i'm hopeless whst i did is created 3 action MenuItems and a class which is speciafied in their Object property. In the main method of the class i wrote this:
static void main(args a)
{
ReportRun runRep;
Args args;
EnumType enumType;
;
switch(enumType)
{
case EnumType ::Type1 : args = new Args("ReportA");
runRep = new reportRun(args);
runRep.run();
case EnumType ::Type2: args = new Args("ReportB");
runRep = new reportRun(args);
runRep.run();
case EnumType ::Type3 : args = new Args("ReportC");
runRep = new reportRun(args);
runRep.run();
case EnumType ::Type4 : args = new Args("ReportD");
runRep = new reportRun(args);
runRep.run();
}
}
I'm getting an error saying that no object is specified for the action MenuItem (and it is specied ) and that there is no design specified for the report so...I'm totally lost..Please help me0 -
u'r example doesn't make sense. where r u initializing the enumType so before entering the switch stmt? It will always default to the first value.
supposing you call a class using an ActionMenuItem ...
void callMyClassWithArgs()
{
args = new args();
menufunction mf;
;
args.parmEnumType(enumNum(MyEnum));
args.parmEnum(MyEnum::MyValue);
mf = new menufunction(MenuItemType::action,menuitemactionstr(mymenuitem));
mf.run(args);
}
then in the main method of class you will do something like
static void main(args args)
{
myenum myenum;
;
myenum = args.parmenum();
(do the switch and the rest of stmts...)
}
Please see that you can also set enum parameters to a Menuitem directly from properties.Kind regards,
Ciprian Dudau
Axapta Developer0 -
ok but where i have to place the code for that method void callMyClassWithArgs() (that you gave me as an example), i call the action menu items from MenuItemButtons...0
-
I already said in that case u should put in the property of the menuitem
OR
overwrite the clicked() method of the menuitembutton, delete super() and place my code instead...Kind regards,
Ciprian Dudau
Axapta Developer0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions