AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 06.06.2007, 10:07   #1  
Blog bot is offline
Blog bot
Участник
 
25,631 / 848 (80) +++++++
Регистрация: 28.10.2006
casperkamal: Creating new Syscontext Menu in Dynamics Ax 4.0
Источник: http://casperkamal.spaces.live.com/B...CD63!302.entry
==============

                     
 Custom menu can be added to "Add-ins" portion of the context menu, this article would explain you in creating  a menu like that...
 
         
 
1. Drag the menuItem that you wanted to be activated in to the syscontextmenu
    \Menus\sysContextMenu
  
2. Create a sub menu if you want your add ins menu to appear under one submenu like Copy\EntierPath or Copy\Name.... or a separator if you want to differentiate that particular menu item.

 
                The moment you drag and drop your menuitem in to Syscontextmenu, the new context menu would start appearing in the context menu. The steps to follow would help you in finding out the objects that are selected and process it.
 
3. The next step would be to decide when the context menu should appear  when you select forms or tables,
   and can it work for multiple selection..
   To implement this you will have to go to
   \Classes\SysContextMenu\VerifyItem - Method
 

   You would find a big switch case statement like this ...
   switch (menuItemType)
  {
        case MenuItemType::Display:
            switch (menuItemName)
            {               

                case menuitemdisplaystr(SysVisioAddIn):
                    ...

                case menuitemdisplaystr(XRefReferencesUsedBy):
                    
                    ...

                case menuitemdisplaystr(SysTableMaps):
                  
                  ...
       }
    case MenuItemType::Action:     
            switch (menuItemName)
            {
                case menuitemactionstr(SysCodeExplorer):
                    ...

                case menuitemactionstr(xRefUpdate) :
                  ...
            }
    } 

 
    Now just write a case for your menuitem depending on the type on the appropriate section
4. You have few variables based on which you could make your decision
   variable: 
   _firstType => has the UtilElementType of the first node selected

 
   Usage: 
    if (_firstType &&
        (_firstType == UtilElementType::Table                 ||
         _firstType == UtilElementType::TableInstanceMethod   ||
         _firstType == UtilElementType::TableStaticMethod     ||
         _firstType == UtilElementType::Macro )

   {
          return 1;
   }  
 

   The menuitem will be enabled only if the  _firstType belongs to any of these specified UtilElementType
 

   variable:
   firstnode  => has the treenode of the first node selected


   Usage:   
   if (firstNode.treeNodePath() == #HelpFilesPath)
  {
        return 1;
  }
 
                 
   Method:
   this.selectionCount() => returns nubmer of node selected
 

   Usage:
  
if(this.selectionCount() >= 1)
  return 1;

 
4.  The object that your menu item is pointing to can have the following code to find the objects that have
been selected

 if (SysContextMenu::startedFrom(args))
 {
      sysContextMenu = args.parmObject();
      treeNode = sysContextMenu.first();
      if (treeNode)
      {
          //Place your code here            
          treeNode = sysContextMenu.first();
      } 
 }

 
5. You can also add items of type MenuReference to your ContextMenu, say you want to have the "GeneralLedger" Module in the ContextMenu, then rightclick select new Menu Reference, you get the link to the module in syscontextmenu...something like this
 
    
 
.........  mmm that's nice right ???



Источник: http://casperkamal.spaces.live.com/B...CD63!302.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Dynamics AX: Managing Your Supply Chain Using Microsoft Dynamics AX 2009 - Book Review Blog bot DAX Blogs 0 31.03.2009 23:06
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Inside Dynamics AX 4.0: Usage Scenarios Blog bot DAX Blogs 0 04.10.2007 05:15
casperkamal: creating Transparent forms in Dynamics Ax Blog bot DAX Blogs 0 20.04.2007 19:20
casperkamal: Creating graphs in Dynamics Ax Blog bot DAX Blogs 1 10.04.2007 21:39

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 00:03.