Share via


MenuFunction.new Method

Creates a new xMenuFunction object by passing xMenuFunction's name and MenuItemType to the xMenuFunction constructor.

Syntax

public void new(str _Name, MenuItemType _type)

Run On

Called

Parameters

  • _Name
    Type: str

Remarks

When creating a xMenuFunction object, the parameters must uniquely identify an existing xMenuFunction. If not, Exception::Internal is thrown.

Examples

In the following example, a try block tries to create and run an object of type MenuFunction. The catch block then handles the specific system class exception and prints an error message.

MenuFunction mf; 
 
try 
{ 
    mf = new MenuFunction("AddressFormat", MenuItemType::Display); 
    mf.run(); 
} 
 
// Exception handler. 
catch(Exception::Internal) 
{ 
    print "MenuFunction does not exist"; 
    pause; 
}

See Also

MenuFunction Class

MenuFunction.run Method

MenuItemType Enumeration