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?
Reply to: XMetaL 8: Is it possible to override Table menu commands?February 3, 2015 at 2:24 am
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.
var tblMenu = HostApplication.CommandBars[“Table”]; // get the Table command-bar
var cmdTableInsertCaption = tblMenu.Controls.item;
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.