This post is machine-translated. The original post in german language can be found here.

Extending the Context Menu of the X++ Editor in Dynamics AX 2012

Some years ago I had already written an article about the class EditorScripts. This is the one with which you can easily extend the functionality of the X++ editor.

For example, you can easily extend the context menu of the editor by creating methods in the class.

These methods only have to meet a few criteria, such as

  • The first and only parameter must be of type Editor.
  • The method must be public
  • The method must not return anything (void)

X++-Editor

Which further criteria the method must fulfill can be read in the method EditorScripts.isApplicableMethod().

If these criteria are met, you can even control the menu structure by naming the method, using the underscore "_" as a separator.

The following method would, for example, create a MyExtensions submenu with an Example entry.

//AOSRunmode::Client
public void MyExtensions_Example(Editor _editor)
{
    //...do something...
}

X++-Editor Example

Nested submenus are also possible:

//AOSRunmode::Client
public void MyExtensions_Examples_Example1(Editor _editor)
{
    //...do something...
}

X++-Editor Example

Furthermore, the naming of the method indirectly defines a keyword which can be used in the editor similar to FOR, WHILE, SWITCH,... in combination with the tab key.

The keyword is the one after the last _ of the method name.
In the following example, "devVersion" (case-sensitive) would be the keyword.

public void template_method_devVersion(Editor _editor)
{
    // do something
}

The method EditorScripts.isApplicableMethod() mentioned above can also be used to control when a method should be offered.

These post applies to following version:
Dynamics AX 2012

Add comment
 
 

 

 
 
 
Posts of the actual month
Februar 2020
MoTuWeThFrSaSu
 12
3456789
10111213141516
17181920212223
242526272829 
 
© 2006-2020 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.