Application Properties and Objects
The fApplication object has been updated in 12.1.0.0 to provide two new properties for toolbars:
• fApplication.toolbars provides a list of all toolbars known by Layout Developer. Each element in this array is an fToolbar object (more on this later).
• fApplication.activeToolbars is slightly different from fApplication.toolbars in that it provide a list of only those toolbars which are currently visible
So, to do something with the list of all the active toolbars, use something like this:
var tools = application.activeToolbars;
for (var t = 0; t < tools.length; t++) {
DO SOMETHING HERE
}
The fApplication object also provides some methods to manage toolbars. The fToolbar object will be described in a separate section.
• fApplication.getToolbar() will return the named fToolbar object so that it can be inspected or changed
• fApplication.createToolbar() will create a new fToolbar object and make it active. The method takes name, location and display arguments.
• fApplication.deleteToolbar() will delete the toolbar from those available to Layout Developer/Layout Editor
• fApplication.clearActiveToolbars() will remove all toolbars from display
• fApplication.addActiveToolbar() will add the specified toolbar to the list of active toolbars
• fApplication.removeActiveToolbar() will remove a specified toolbar from display
• fApplication.refreshToolbars() will tell Layout Developer/Layout Editor to refresh the visible toolbars once changes have been made
• fApplication.suspendToolbarRefresh() is a method which tells Layout Developer/Layout Editor not to refresh/redraw the toolbars while you are working on them so as to reduce any flicker which may occur. This method takes a boolean argument to suspend or un-suspend the refresh.
So, to add a toolbar to the active ones, use something like this:
var bm = application.getToolbar("big_main");
application.addActiveToolbar(bm);
bm.display = fToolbar.DISPLAY_ICONS;
bm.location = fToolbar.LOCATION_TOP;
application.refreshToolbars();
Or
application.addActiveToolbar("big_main");
application.refreshToolbars();
And to remove it again, use something like this:
var bm = application.getToolbar("big_main");
application.removeActiveToolbar(bm);
application.refreshToolbars();
Or
application.removeActiveToolbar(“big_main”);
In order to save and load toolbars, fApplication also has these methods:
• fApplication.saveToolbars() will save the state of the currently active toolbars — this does not save which toolbars are active, the user must save their preferences to make these stay active next time ALD starts
• fApplication.loadToolbars() will load toolbars from the specified file path. If a file path isn’t provided, the default preferences file will be used.
The fApplication object provides methods to create and manage the toolbar actions (see later section):
• fApplication.getToolbarAction() will return the fToolbarAction object named so that it can be used
• fApplication.createToolbarAction() will create a new fToolbarAction object