ModuleObject.focus

Syntax

focus();

Description

The focus method processes passing focus to a module or its elements.

Comments

Method implementation depends on classes inherited from ModuleObject. Currently, this method is implemented only by PP.Application.EaxModuleObject.

Example

Executing the example requires that an express report is opened and the script given below is started in the browser console.

Call handlers of the blur, focus and focusout events and check how they affect the express report change:

// Get current unit object
var moduleObject = PP.App.getModuleObject();
// Determine function to check if express report was changed
var defineIsChanged = function (event) {
    if (moduleObject.setIsChanged()) {    
        console.log("Express report after handling the " + event +
            " was changed");
        // Reset whether express report was changed
        moduleObject.setIsChanged(null);
    } else {    
        console.log("Express report after handling the " + event +
            " was not changed");
    };
};
// Set whether express report was not changed
moduleObject.setIsChanged(null);
// Handle the event of losing focus by form input fields
moduleObject.blur();
// Check if express report is changed
this.defineIsChanged("blur");
// Handle event of transferring focus to unit or its elements
moduleObject.focus();
// Check if express report is changed
this.defineIsChanged("focus");
// Handle event of losing focus by unit or its element
moduleObject.focusout("focusout");
// Check if express report is changed
this.defineIsChanged();

After executing the example it is found that the blur and focusout event handlers do not affect the indication of express report change, and the focus event handler indicates that the express report has been changed:

Express report after processing the blur event has not been changed

Express report after processing the focus event has been changed

Express report after processing the undefined event has not been changed

See also:

ModuleObject