Home Forums General XMetaL Discussion XMetaL 8: Is it possible to override Table menu commands? Reply To: XMetaL 8: Is it possible to override Table menu commands?

Derek Read

Reply to: XMetaL 8: Is it possible to override Table menu commands?

The menu override you are thinking of for File menu related actions isn't actually tied to the File menu, it is tied to the actions the File menu calls and is limited to a specific set (as documented in the Programmers Guide under “File operations”). There is no general menu-override functionality.

From the Programmers Guide (buried nicely inside the topic “When XMetaL starts or closes”):

The event macro On_Default_CommandBars_Complete is called after the workspace has been loaded and toolbars have been set up. If you want to make modifications to the menus and toolbars, you can do it here; however, you cannot affect the visibility of toolbars from this event. Instead, use the On_CommandBars_Activate or On_CommandBars_DeActivate events.

It says “can”, and though it is true this isn't the only event you can do this it is the event you should use in almost all cases (and I can think of no reason to use another event).

You definitely can delete a CommandBarControl. Here's the example from the Programmers Guide:

[code]// XMetaL Script Language JSCRIPT:
var cmdBars = Application.CommandBars;
var cmdBar = cmdBars.item(“Standard”);
// get the first button
var cmdBarControl = cmdBar.Controls.item(1);
cmdBarControl.Delete();// delete it from the command bar
Application.Alert(“deleted command bar button”);
cmdBar.Reset();// bring it back[/code]

Reply

Products
Downloads
Support