Flash Drawing Control

Run an action using a right-click event in a Flash drawing

Note: With the release of ARCHIBUS V.23.2, all ARCHIBUS views were converted to use the HTML drawing control instead of the Flash drawing control. If you have previously created views that use the Flash drawing control, the view's drawings will still work.

For new views that you create, ARCHIBUS, Inc. recommends using the HTML control, as the Flash control is slated for desupport in future versions of ARCHIBUS. For information on converting existing views with Flash drawings to HTML format, see Convert views with the Flash drawing control to the HTML drawing control.

When a user clicks the right mouse button on the flash-based drawing control, by default the system brings up a standard menu with a number of options. The application view may also define additional menu options for that right-mouse-click event. For example, when viewing a floor plan, a Space Manager may wish to have the option to edit a selected room's attributes, add or edit room transaction records, or edit any pending room requests.

The following describes how to implement this functionality.

Register an event handler for the onload event for the drawing panel:

var controller = View.createController(‘abSpAsgnRmCatRmTypeToRm_Control’, {
       afterViewLoad: function() {
           this.abSpAsgnRmcatRmTypeToRm_drawingPanel.addEventListener('onload',
               onLoadHandler);
       }
});

The drawing panel’sonload event handler should construct an array of menu items to be appended to the Drawing Control right click menu. Each new menu item must have a title and Java Script callback function defined for that menu item. The setRightClickMenu function creates the new menu items:

function onLoadHandler() {
   var item0 = {title: getMessage(“editRoom”), handler: “editRoom”};
    var item1 = {title: getMessage(“shareRoom”), handler: “shareRoom”};
    var items = [item0, item1];
    View.panels.get(‘abSpAsgnRmcatRmTypeToRm_drawingPanel’).setRightClickMenu(items);
}

The callback function is where the application-specific functionality will reside. For example:

function editRoom(ob) {
    if (ob.length > 0) {
        var restriction = new Ab.view.Restriction();
        restriction.addClause(‘rm.bl_id’, ob[0].value);
        restriction.addClause(‘rm.fl_id’, ob[1].value);
        restriction.addClause(‘rm.rm_id’, ob[2].value);
        View.openDialog(‘ab-sp-def-loc-rm.axvw’, restriction);
    }
}

View: http://localhost:8080/archibus/schema/ab-products/solutions/drawing/ab-ex-rightclickmenu.axvw

Copyright © 1984-2018, ARCHIBUS, Inc. All rights reserved.