miercuri, 3 decembrie 2008

Adding Items to the AOT Add-Ins Menu

Adding Items to the AOT Add-Ins Menu

 


 

Collapse All Expand All

The shortcut menu in the Application Object Tree (AOT) has an Add-ins menu where you can find various development tools such as the cross-reference system and the Visual MorphXplorer.

To add your own tool to the Add-ins submenu

  1. Create a menu item for the tool.
  2. Locate the item you want to add to the Menu
    Items node.
  3. Drag the menu item onto sysContextMenu in the Menus node.

Enabling and Disabling Menu Items According to Context

All items in the sysContextMenu menu are automatically added to the Add-ins submenu. If you want to disable items according to the current context, you need to add to the verifyItem method for the SysContextMenu class.

verifyItem( identifiername
MenuItemName , MenuItemType
MenuItemType ) is automatically called for each item you add to the sysContextMenu menu. It takes the name of the menu item and the menu item type as parameters, and must return 0 (zero) if the item isn't available.

Example

The following extract from verifyItem shows the testing performed when the parameter is the menu item MorphXplorer.

Copy Code

case menuItemDisplayStr(MorphXplorer):

if (this.selectionCount() != 1 ||

firstNode.AOTIsOld() //Does not work for old nodes

)

{

return 0;

}

if (!docNode &&

(_firstType==UtilElementType::Class ||

_firstType==UtilElementType::Table))

{

return 1;

}

return 0;

Tip

There are other classes called SysContextMenu*, for example, SysContextMenuCompare. These classes are used when there are several levels in the add-ins hierarchy. For example, when you activate Compare on two objects, the Add-ins submenu is also available in the Compare dialog. The first() and next() methods on sysContextMenuCompare define the proper context.

 

Number sequence framework

Number sequence framework

This topic describes how to implement the number sequence framework for a new module ("MyModule") in Axapta. Some of the steps below might be irrelevant, if they have been previously carried out for other purposes in your new Axapta module.

  • Create a parameter table for the new module: MyModuleParameters.
    This table must follow the standard Axapta design for parameter tables. This means that the table must, as a minimum, contain a Key field, and the standard method: Find. Furthermore, some standard methods must be overloaded (delete and update). These can be copied from one of the other parameter tables.
  • Create an enumerated value for the number sequence value.

NOTE

  • Configuration keys are used to detect the active number sequence references in your Axapta installation. If the configuration key is not enabled, the modules number sequence references are not displayed in the general References form. This means that the user cannot see references from modules that are not enabled.

 
 

  • Implement static methods.
    MyModuleParameters::numberSeqModule()
    Reference the enumerated value in the number sequence module enumerator here.

    MyModuleParameters::numberSeqReference()
    Copy these from one of the other parameter tables, and change the names.
  • Add line in method.
    Add MyModuleParameters::Find() in method Company.selectParameters().
  • Create a form to display the new parameter table.
    It's important that the functionality of number sequence references is copied exactly from one of the other parameter forms (e.g., copy methods, query, properties, etc.) Remember to correct names of the called methods.
  • Create new class.
    NumberSeqReference_MyModule and let this class extend class: NumberSeqReference.
  • Add line in method. NumberSeqReference::Construct()
    Copy one of the existing lines, and change the feature key and class name.
  • Add line in method. NumberSeqReference.loadAll()
    Copy one of the existing lines, and change the name of the parameter table.

Your framework is now established. When you run your new parameter form, you should not get any errors. On the Number sequence tab page, you should get the message: "No setup required".

To make number sequence references for your new module, you must:

  • Overload the method:
    NumberSeqReference.loadModule()
     
  • Create new method:
    NumberSeqReference_MyModule.loadModule()
    In this new method, specify each reference needed in your new module.

Please refer to the written documentation in method NumberSeqReference.loadModule() for details on how to create a reference.

After creating your references, the system will automatically detect them when opening the parameter form. This is now visible in the grid on the Numbersequence tab page.

How to refer to your new references

For each reference specified in NumberSeqReference_MyModule.loadModule(), you must create a static method on your parameter table. Assuming you have specified a reference for the datatype: MyDataType, you need to create the method: MyModuleParameters::numRefMyDataType().

Copy a "numRef" method from one of the other parameter tables, and change the names of the method to numRefMyDataType, and the referenced data type to MyDataType.

You are now ready to refer to the reference from the X++ code, for example:

MyNewId = NumberSeq::newGetNum(MyModuleParameters::numRefMyDataType()).

marți, 10 iunie 2008

Dynamics AX

Salut,

Acesta este noul blog cu informatii despre AX.

Best regards,

Liviu Stoica