This event is generated when a user pulls down a macros menu.
Syntax: |
---|
function OnMenuUpdateCommand(cmd) |
Parameters
Parameter | Description |
---|---|
cmd | An object DlxCommand. |
Remarks
When a user pulls down a macro menu, each menu item needs to know whether it should be displayed as enabled or disabled. The target of a menu command provides this information by implementing an handler for this event.
When the menu is pulled down, each handler calls DlxCommand member functions such as Enable and SetCheck, and the menu then appropriately displays each menu item.
Example
Copy code | |
---|---|
function OnMenu()
{
var menu = DlxApp.GetMenu(DlxApp.MENU_DWG);
if (menu.IsValid())
{
var subMenu = menu.AddMenu("My Macro");
subMenu.AddCommand("command10", 10, "Description of command 10\nCmd10");
subMenu.AddCommand("command20", 20, "Description of command 20\nCmd20");
subMenu.AddLabel("Label");
subMenu.AddCommand("command30", 30, "Description of command 30\nCmd30");
subMenu.AddCommand("command40", 40, "Description of command 40\nCmd40");
subMenu.AddSeparator();
subMenu.AddCommand("command50", 50, "Description of command 50\nCmd50");
subMenu.AddCommand("command60", 60, "Description of command 60\nCmd60");
}
}
function OnMenuUpdateCommand(cmd)
{
switch (cmd.GetCommandId())
{
case 10:
cmd.Enable(true);
break;
case 20:
cmd.Enable(true);
break;
case 30:
cmd.Enable(true);
break;
case 40:
cmd.Enable(true);
cmd.SetCheck(true);
break;
case 50:
cmd.Enable(false);
break;
case 60:
cmd.Enable(true);
break;
}
}
function OnMenuCommand(cmdId)
{
switch (cmdId)
{
case 10:
DlxApp.Printf("CmdId 10");
break;
case 20:
DlxApp.Printf("CmdId 20");
break;
case 30:
DlxApp.Printf("CmdId 30");
break;
case 40:
DlxApp.Printf("CmdId 40");
break;
case 50:
DlxApp.Printf("CmdId 50");
break;
case 60:
DlxApp.Printf("CmdId 60");
break;
}
}
|