Respond to an event
virtual void Update( CXlCancellableRangeEventArgs* e ); |
A pointer to an event arguments object is sent to the Update method.
Derived classes should implement this function, which is the event handler for the XLL+ event model.
The code below defines a class derived from CXlBeforeDoubleClickEventStaticObserver, implements an Update method which is called when the event occurs, and instantiates an instance of the new class.
Note that this particular Update method uses CXlCancellableRangeEventArgs::SetCancel to cancel the double-click event. As a result, Excel does not switch to edit mode.
// Define a class derived from CXlBeforeDoubleClickEventStaticObserver class CMyBeforeDoubleClickEventObserver : CXlBeforeDoubleClickEventStaticObserver { public: // This method will be called during the XlBeforeDoubleClick event. virtual void Update(CXlCancellableRangeEventArgs* e) { CXllApp::XlMessageBox(_T("Double-click at ") + e->GetRange(), XlMessageBoxTypeInformation); e->SetCancel(true); } }; // Create an instance of the class CMyBeforeDoubleClickEventObserver myDoubleClickObserver;
Header: xlpevents.h
CXlBeforeDoubleClickEventStaticObserver Class | CXlBeforeDoubleClickEventStaticObserver Methods