Turns the monitoring of selection changes on/off.
GSErrCode ACAPI_Notify_CatchSelectionChange ( APISelectionChangeHandlerProc* handlerProc );
Parameters
- handlerProc
- [in] The callback procedure to call when notifications are sent out on changes in the selection. Specifying
nullptr
here means you don’t need the notifications any more.
Return Values
NoError
- The function completed successfully.
For other common errors see the list of error codes.
Remarks
This function is used to register/unregister an add-on which wants to monitor the changes in selection. You do not have to call ACAPI_KeepInMemory
afterwards, as the API ensures that add-ons with installed notification handlers won’t be unloaded.
After registration your add-on’s handlerProc
you will be called when the selection changes.
Example
// ----------------------------------------------------------------------------- // Selection change handler function // ----------------------------------------------------------------------------- static GSErrCode __ACENV_CALL SelectionChangeHandler (const API_Neig *selElemNeig) { char msgStr[256]; if (selElemNeig->neigID != APINeig_None) { sprintf (msgStr, "Last selected element: NeigID %d; index: %d, inIndex: %d", selElemNeig->neigID, selElemNeig->index, selElemNeig->inIndex); ACAPI_WriteReport (msgStr, false); } else ACAPI_WriteReport ("All elements deselected", false); return NoError; } // SelectionChangeHandler // ----------------------------------------------------------------------------- // Called after the Add-On has been loaded into memory // ----------------------------------------------------------------------------- GSErrCode __ACENV_CALL Initialize (void) { // catch changes in the selection GSErrCode err = ACAPI_Notify_CatchSelectionChange (SelectionChangeHandler); return err; } // Initialize
Requirements
- Version: API 4.1 or later
- Header: ACAPinc.h
See Also
ACAPI_KeepInMemory, APISelectionChangeHandlerProc,
Notification Manager, API Functions