APILockChangeHandlerProc

User supplied callback procedure for handling reservation changes of lockable objects.

    typedef GSErrCode  APILockChangeHandlerProc (
        const API_Guid&     objectId,
        short               ownerId
    );

 

Parameters

objectId
[in] Identifies the lockable object set that has been reserved or released. The available identifiers are listed at the description of lockable object sets.
ownerId
[in] The identifier of the locker team member who obtained the reservation, or 0 if the lockable object got released.

 

Return Values

NoError
The function has completed with success.

For other common API errors see the API Errors document.

 

Remarks

This callback function should be implemented and set with ACAPI_Notify_CatchLockableReservationChange in order to receive notifications of reservation changes of lockable objects.

You can retrieve information of the members with the APIEnv_ProjectSharingID environment function. Note that the handler receives reservation changes effected by the current team member as well.

In the reservation change handler try to avoid calling functions that would modify the database.

 

Example


// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
GSErrCode __ACENV_CALL  LockableReservationChangeHandler (const API_Guid& objectId, short ownerId)
{
    GS::UniString reportString;

    if (objectId == ACAPI_TeamworkControl_FindLockableObjectSet ("FillTypes"))
        reportString.Append ("Fill Types");
    else 
        reportString.Append ("Layer Settings");

    if (ownerId > 0)
        reportString.Append (" got reserved");
    else 
        reportString.Append (" got released");

    ACAPI_WriteReport (reportString.ToCStr ().Get (), false);

    return NoError;
}


// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void    CatchReservationChangesOfFillTypesAndLayerSettings (bool enableNotifications)
{
    if (enableNotifications) {
        GS::HashSet<API_Guid> filterLockablesInterestedOnly;
        filterLockablesInterestedOnly.Add (ACAPI_TeamworkControl_FindLockableObjectSet ("FillTypes"));
        filterLockablesInterestedOnly.Add (ACAPI_TeamworkControl_FindLockableObjectSet ("LayerSettingsDialog"));
        ACAPI_Notify_CatchLockableReservationChange (ElementReservationChangeHandler, &filterLockablesInterestedOnly);
    } else {
        ACAPI_Notify_CatchLockableReservationChange (nullptr);
    }
}

 

Requirements

Version: API 15 or later
Header: APIdefs_Callback.h

 

See Also

ACAPI_Notify_CatchLockableReservationChange
Teamwork Control
Notification Manager
API Functions