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?

paorear

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

You have written code that removes the Table > Insert Caption item and replaces it with your own item that runs your own macro, correct? That's what you need to do to do if you want to do something special with that menu item that is different from what it already does. The resulting table model still needs to be CALS or HTML though.

No – I'm simply trying to find a way to make the default behavior work correctly. All the other standard Table menu items work fine for us and this one almost does except for the behavior I described earlier. If I could find a way to replace the standard menu item I would, but using the CommandBars approach only affects the Tables toolbar and not the menu. And there is no Insert Caption button in the toolbar either.

For example, my C# code that is similar to what you'd do in JavaScript looks like this:

var tblMenu = HostApplication.CommandBars[“Table”]; // get the Table command-bar

var cmdTableInsertCaption = tblMenu.Controls.item[4];
cmdTableInsertCaption.Delete();

This successfully removes an item from the Table command bar, but has no effect on the menu. If you see earlier in our thread here, I tried iterating over the controls in the Table command bar to see what each one was and I listed them all out. Insert Caption isn't among them, and regardless, deleting items from this command bar has no effect on the menu no matter which control I delete. It only affects the toolbar.

Paul

Reply

Products
Downloads
Support