Tool Host
Tools are easy-to-develop 100%-reusable independent modules. You can wrap your legacy .NET code in a tool, and use this code from any application developed on AL Platform's basis. One tool can serve your needs in different applications, and the application can work with any number of tool instances. We call such applications tool hosts.
A tool host defines how a tool view is rendered, and provides some infrastructural layer which the tool might want to utilize. The tool host performs the following tasks:
- manages application menu. The tool host allows you to define menu items in a unified way, which allows them to be displayed correctly on any GUI Framework you use.
- renders a tool view in a workspace. For now the workspace allows a tool view to be shown either as a dockable window (docked left, right, top, bottom, floating) or as MDI child form.
- allows a tool to export its menu items. In other words, the tool host gives an opportunity for a tool to show its menu items in application's main menu, context menu, tool bar, and status bar.
Unified Menu
A tool host gives you the opportunity to define menu items in a unified way, which allows them to be displayed correctly on any GUI Framework you use. For now we provide Standard Windows Forms, Infragistics, Syncfusion, and MS Office GUI Frameworks. Our AL Office+ Pack gives you the ability to work with MS Office menu the same way you do when developing a standard desktop application.
AL Platform defines 4 menu areas: Main Menu, Context Menu, Tool Bar, and Status Bar.
Whatever area you are going to affect, you create an Al.DesktopApplication.MenuItem instance. MenuItem is a base class from which we derived PopupMenuItem, StateMenuItem, and StaticMenuItem. Some MenuItem properties are listed below:
Caption, Enabled, Image, IsFirstInGroup, Name, Shortcut, ShowShortcut, Tooltip, Visible, Width.
Exporting Tool Menu Items
A tool host allows a tool to export its menu items. In other words, the tool host gives an opportunity for the tool to show its menu items in application's main menu, context menu, tool bar, and status bar. Whatever the number of tool instances is, each tool instance has its own menu. This particularly means that actions upon menu items will affect only active tool instance.
Tool's menu items get disabled once there is no active tool. However, if there is only one tool instance, its menu items will work with no difference whether the tool is active or not. Also, you can define tool's menu as shareable, meaning that menu items won't change their state (enabled, disabled, image, etc.) after changing the active tool.
Workspace
A tool host renders a tool view in a workspace. For now the workspace allows a tool view to be shown either as a dockable window (docked left, right, top, bottom, floating) or as MDI child window. In order to make a tool view dockable, you simply implement the IDesktopDockable interface. The only member this interface contains is
DockedLocation InitialDockedLocation { get; }
Because some GUI Frameworks (like Standard Windows) doesn't allow dockable windows, controls are shown in MDI Child forms.