Altova UModel 2025 Professional Edition

The plug-in allows you to change the user interface (UI) of UModel. This is done by describing each separate modification using an XML data stream. The XML configuration is passed to UModel using the GetUIModifications method of the IUModelPlugIn Interface.

 

The XML file containing the UI modifications for the plug-in must have the following structure:

 

  <ConfigurationData>
    <ImageFile>path To image file</ImageFile>
    <Modifications>
        <Modification>
           ...
        </Modification>
        ...
    </Modifications>
  </ConfigurationData>

 

You can define icons, or toolbar buttons for the new menu items which are added to the UI of UModel by the plug-in. The path to the file containing the images is set using the ImageFile element. Each image must be 16 x 16 pixels. The image references must be arranged from left to right in a single (<ImageFile>...) line. The rightmost image index value is zero.

 

The Modifications element can have any number of Modification child elements. Each Modification element defines a specific change to the standard UI of UModel. It is also possible to remove UI elements from UModel.

 

Structure of Modification elements

All Modification elements consist of the following two child elements:

 

  <Modification>
    <Action>Type of action</Action>
    <UIElement Type="type of UI element">
    </UIElement>
  </Modification>

 

Valid values for the Action element are:

 

Add - used to add the following UI element to UModel.

Hide - used to hide the following UI element in UModel.

Remove - used to remove the UI element from the "Commands" list box, in the customize dialog

 

You can combine values of the Action element e.g. "Hide Remove".

 

The UIElement element describes any new, or existing UI element for UModel. Possible elements are currently: new toolbars, buttons, menus, or menu items. The Type attribute defines which UI element is described by the XML element.

 

Common UIElement children

The ID and Name elements are valid for all different types of XML UIElement fragments. It is, however, possible to ignore one of the values for a specific type of UIElement, e.g. Name is ignored for a separator.

 

  <ID></ID>
  <Name></Name>

 

If UIElement describes an existing element of the UI, the value of the ID element is predefined by UModel. Normally these ID values are not known to the public. If the XML fragment describes a new part of the UI, then the ID is arbitrary and the value should be less than 1000.

 

The Name element sets the textual value. Existing UI elements can be identified just by name, e.g. menus and menu items with associated sub menus. For new UI elements, the Name element sets the caption, e.g. the title of a toolbar, or text for a menu item.

 

Toolbars and Menus

To define a toolbar, it's necessary to specify the ID and/or the name of the toolbar. An existing toolbar can be specified using only the name, or by the ID if it is known. To create a new toolbar, both values must be set. The Type attribute must be equal to "ToolBar".

 

  <UIElement Type="ToolBar">
    <ID>1</ID>
    <Name>Styles</Name>
  </UIElement>

 

To specify an UModel menu, you need two parameters:

 

The ID of the menu bar which contains the menu. UModel's main menu bar ID is 101.

The menu name. Menus do not have an associated ID value. The following example defines the "Edit" menu of the menu bar:

 

  <UIElement Type="Menu">
    <ID>101</ID>
    <Name>Edit</Name>
  </UIElement>

 

An additional element is used if you want to create a new menu. The Place element defines the position of the new menu in the menu bar:

 

  <UIElement Type="Menu">
    <ID>101</ID>
    <Name>PlugIn Menu</Name>
    <Place>12</Place>
  </UIElement>

 

A value of -1 for the Place element sets the new button or menu item at the end of the menu or toolbar.

 

Commands

If you add a new command through a toolbar button or a menu item, the UIElement fragment can contain any of these sub elements:

 

  <Info></Info>
  <ImageID></ImageID>

 

The Info element contains a short description string which is displayed in the status bar, when the mouse pointer is over the associated command (button or menu item). ImageID defines the index of the icon in the external image file. Please note that all icons are stored in one image file.

 

To define a toolbar button create an UIElement with this structure:

 

  <UIElement Type="ToolBarItem">
    <!--don't reuse local IDs even the commands do the same-->
    <ID>6</ID>
    <Name>Fill red</Name>
    <!--Set Place To -1 If this is the first button to be inserted-->
    <Place>-1</Place>
    <ImageID>0</ImageID>
    <ToolBarID>1</ToolBarID>
    <!--instead of the toolbar ID the toolbar name could be used-->
    <ToolBarName>Styles</ToolBarName>
  </UIElement>

 

Additional elements to declare a toolbar button are Place, ToolBarID and ToolBarName. ToolBarID and ToolBarName are used to identify the toolbar which contains the new or existing button. The textual value of ToolBarName is case sensitive. The (UIElement) type attribute must equal "ToolBarItem".

 

To define a menu item, the elements MenuID, Place and Parent are available in addition to the standard elements used to declare a command. MenuID must be 101. See "Toolbars and Menus" for more information on these values.

 

The Parent element is used to identify the menu where the new menu entry should be inserted. As sub menu items have no unique Windows ID, we need some other way to identify the parent of the menu item.

 

The value of the Parent element is a path to the menu item.

 

The text value of the Parent element, must equal the parent menu name of the submenu, where the submenu name is separated by a colon. If the menu has no parent, because it is not a submenu, add a colon to the beginning of the name. The type attribute must be set to "MenuItem".

 

Example for an UIElement defining a menu item:

 

  <UIElement Type="MenuItem">
    <!--the following element is a Local command ID-->
    <ID>3</ID>
    <Name>Fill red</Name>
    <Place>-1</Place>
    <MenuID>101</MenuID>
    <Parent>:PlugIn Menu1</Parent>
    <ImageID>0</ImageID>
  </UIElement>

 

UModel makes it possible to add toolbar separators and menus if the value of the ID element is set to 0.

© 2018-2024 Altova GmbH