Please enable JavaScript to view this site.

QPR Knowledge Base 2023.1

  •      
  • Navigation: Developer's Guide > QPR API > The Object Model > QPR Modeling > PGModel Commands

    GetActive

    Scroll Prev Top Next More

    Revision history:

    Introduced in QPR 7.3.1

    Last changed in QPR 2015.1

     

    Returns the ID of an item of the selected type that is active in the user interface.

     

    Synopsis:

     

    PGModel.GetActive(ActiveType, OutID)

     

    Parameters:

     

    ActiveType: String. The type of the active element wanted. Currently supported types are:

    MODEL: Returns the ID of the model that is currently open.

    PROCESSMODEL: Returns the ID of the process model element.

    PROCESSLEVEL: Returns the diagram ID of active diagram or navigator window. If a top level diagram is active, 0 is returned.

    MAINPROCESSLEVEL: Returns the diagram ID of the main (top) diagram.

    ELEMENT: Returns active diagram, diagram explorer or navigator window's active element ID. In the case multiple elements are selected, an error is returned. Supports also context menu execute procedure.

    USER: Returns the ID of the user who is currently logged in.

    BASEMODEL: Returns the ID of the base model the current model is using. In the case the model does not use a base model, 0 is returned.

    VIEWSETTINGS: Returns the ID of the view settings in the active view (Diagram, Navigator View, or Matrix View).

    ELEMENTINSTANCE: Returns the full ID (<elementId>.<instanceId>) of the active element as string. In case the active element doesn't support instantiating, an error is returned.

    EXPLORER: Returns the active (OnFocus) explorer + the information if procedure script was executed from context popup menu: DIAGRAM = 2, DIAGRAM + CONTEXTMENU (execute procedure) = 3, NAVIGATORVIEW = 4, NAVIGATORVIEW + CONTEXTMENU = 5, DIAGRAMEXPLORER = 6, DIAGRAMEXPLORER + CONTEXTMENU = 7. This function can be used with GetActive("ELEMENT") to check out that in where the active element was found.

    DIAGRAMITEM: Returns the selected element's Id on Diagram view. Note that active windows i.e. focus can be on different Window than the Diagram view.

    DIAGRAMEXPLORERITEM: Returns the selected element's Id on Diagram explorer. Note that active windows i.e. focus can be on different Window than the Diagram view.

    NAVIGATORVIEWITEM: Returns the selected element's Id on Navigator view . In the case multiple elements are selected or no element, an error is returned. Note that active windows i.e. focus can be on different Window than the Navigator view.

    CONTEXTMENUPARENT: Returns the active element's Id on where the popup menu was opened and script/procedure executed. NOTE that this works only when executing QPR Scripts located inside procedure custom attributes.

    OutID: Variant for storing the ID of the returned element. Integer.

     

    Required Rights:

     

    None.

     

    Return Values:

    Below are listed the return values that this function can return:

     

    RV_SUCCESS

    RV_APPLICATION_QUIT_CALLED

    RV_MODEL_NOT_OPEN

    RV_NO_ACTIVE_PROCESS_LEVEL

    RV_NO_ACTIVE_ELEMENT

    RV_NO_ACTIVE_VIEW_SETTINGS

    RV_NOT_AUTHENTICATED

    RV_INVALID_PARAMETER

    RV_INSTANCE_NOT_FOUND

     

    Example Procedure:

     

    iResult = PGModel.GetActive("USER", iId)