Reply to: XMetal Menu ProblemMay 6, 2009 at 7:33 pm
This is going to be trickier to do as scripting changes to toolbars and menus are meant to be done at application startup or at document (DTD/Schema) open as part of either an application level (customization) macro or document level (customization) macro. You might be able to make changes during other events, but we do not test those scenarios. If such a script is run manually by a user it will probably work, but it will affect the particular document level customization currently loaded, or if one is not loaded it will affect the application level customization.
Do you mean that you wish to allow your users to switch between different language versions of toolbars at any time during editing? I'm not sure why that would be a requirement (not arguing that it shouldn't be, just wondering)? The only solution I can think of is to check for the number of documents open (Documents.Count) and if the value is larger than 0 tell the user they must close all documents before running your script.
To answer your question… When XMetaL Author launches it first loads up a default set of toolbars and menus. These are governed by the content of the file named default.tbr. To this are added any changes that fire in scripts at application startup. When a document is opened the yourDocType.tbr file (that matches yourDocType.dtd or yourDocType.xsd in your customization) are added on top of the default settings along with any scripts that fire at document open.
This allows the product to have menu and toolbar items that should be available at all times (for example File > Open, etc) and then add specific items that only have special meaning in the context of a specific document type. When you switch between different document types the menus and toolbars are automatically updated.