XLL+ Class Library (7.0)

CXlEvent<T> Class

The template class for event subjects. This class implements the Subject of the observer pattern.

class CXlEvent<T>

Overview

In the observer-based event model, CXlEvent is the base class for all event subjects.

An observer of type CXlEventObserver<T> is added to the set of listeners for an event by calling CXlEvent::Register. It can be removed by calling CXlEvent::Unregister.

When CXlEvent::NotifyObservers(T*) is invoked, the argument of type T* (where T is a class derived from CXlEventArgs) will be passed to the Update(T*) method of each observer.

Deriving a class from CXlEvent<T>

A class derived from CXlEventObserver should implement a concrete constructor. The class may optionally implement CXlEvent::BeforeFirstRegister() and CXlEvent::AfterLastUnregister(), which are called before the first observer is registered, and after the last observer is unregistered, respectively.

Event classes

The table below lists the concrete event classes derived from CXlEvent.

Class Description
CXllOpenEvent Occurs when the XLL is opened, after OnXllOpenEx().
CXllCloseEvent Occurs when the XLL is closed, before OnXllClose().
CXlRegisterFunctionsEvent Occurs before the XLL's add-in functions are registered.
CXlNewWorkbookEvent Occurs when a new workbook is created.
CXlSelectionChangeEvent Occurs when Excel's active cell selection is changed.
CXlBeforeDoubleClickEvent Occurs when the user double-clicks in a worksheet.
CXlBeforeRightClickEvent Occurs when the user right-clicks in a worksheet.
CXlSheetActivateEvent Occurs when a worksheet is activated.
CXlSheetDeactivateEvent Occurs when a worksheet is deactivated.
CXlCalculateEvent Occurs just after Excel has finished calculating a worksheet.
CXlSheetChangeEvent Occurs when a cell is changed in a worksheet.
CXlWorkbookOpenEvent Occurs when a workbook is opened.
CXlWorkbookActivateEvent Occurs when a workbook is activated.
CXlWorkbookDeactivateEvent Occurs when a workbook is deactivated.
CXlWorkbookBeforeCloseEvent Occurs when a workbook is about to be closed, and allows the event to be cancelled.
CXlWorkbookBeforeSaveEvent Occurs when a workbook is about to be saved, and allows the event to be cancelled.
CXlWorkbookNewSheetEvent Occurs when a new worksheet is added to a workbook.

Requirements

Header: xlpevents.h

See Also

CXlEvent<T> Methods | xlpevents.h | Events