Call this method to set the user-interface item for this command to the appropriate check state.
Syntax: |
DlxCommand.SetCheck(bCheck)
|
Parameters
Parameter |
Description |
bCheck |
Specify true to check the item, false to uncheck it. |
Return Value
If the operation ends correctly it returns true otherwise it returns false.
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;
}
}
|
See also