APIProjectEventHandlerProc

Callback function to receive notifications on changes of the project.

    typedef GSErrCode  APIProjectEventHandlerProc (
        API_NotifyEventID     notifID,
        Int32                 param
    );

 

Parameters

notifID
[in] The type of the project event the notification is for.
param Featuring API 10
[in] This parameter is valid only if the notifID is APINotify_ChangeLibrary. If an individual library part has changed in the library (e.g. it was added to the library), then this parameter contains the index of that library part.
Featuring API 20 This parameter is also valid if notifID is APINotify_ChangeProjectDB, and contains a code for the cause of the event.

param

Event cause

0

Other

1

Floor(s) edited

2

Merge

 

Return Values

NoError
The function has completed with success.

For other common API errors see the API Errors document.

 

Remarks

This is the function which will be called when your add-on requested notifications on project events with ACAPI_Notify_CatchProjectEvent.

 

Example


// -----------------------------------------------------------------------------
// Project event handler function
// -----------------------------------------------------------------------------
static GSErrCode __ACENV_CALL    NotificationHandler (API_NotifyEventID notifID, Int32 param)
{
    char    msgStr[256] = { '\0' };

    switch (notifID) {
        case APINotify_New:                CHCopyC ("APINotify_New", msgStr);             break;
        case APINotify_NewAndReset:        CHCopyC ("APINotify_NewAndReset", msgStr);     break;
        case APINotify_Open:               CHCopyC ("APINotify_Open", msgStr);            break;
        case APINotify_PreSave:            CHCopyC ("APINotify_PreSave", msgStr);         break;
        case APINotify_Save:               CHCopyC ("APINotify_Save", msgStr);            break;
        case APINotify_Close:              CHCopyC ("APINotify_Close", msgStr);           break;
        case APINotify_Quit:               CHCopyC ("APINotify_Quit", msgStr);            break;

        case APINotify_SendChanges:        CHCopyC ("APINotify_SendChanges", msgStr);     break;
        case APINotify_ReceiveChanges:     CHCopyC ("APINotify_ReceiveChanges", msgStr);  break;

        case APINotify_ChangeProjectDB:    CHCopyC ("APINotify_ChangeProjectDB", msgStr); break;
        case APINotify_ChangeWindow:       CHCopyC ("APINotify_ChangeWindow", msgStr);    break;
        case APINotify_ChangeFloor:        CHCopyC ("APINotify_ChangeFloor", msgStr);     break;
        case APINotify_ChangeLibrary:      if (param != 0)
                                               sprintf (msgStr, "APINotify_ChangeLibrary for library part #%ld", param);
                                           else
                                               CHCopyC ("APINotify_ChangeLibrary", msgStr);
                                           break;
    }

    ACAPI_WriteReport (msgStr, false);

    return NoError;
}   // NotificationHandler

 

Requirements

Version: API 4.1 or later
Header: APIdefs_Callback.h

 

See Also

API_NotifyEventID
ACAPI_Notify_CatchProjectEvent
API Functions