GetEventHandler
Get the event handler class name if present
string GetEventHandler( BOOL bCheckValid = false, BOOL bDeafult = FALSE )
If bCheckValid = [input] false, simply return the class name or empty string if no event handler was installed.
If bCheckValid = [input] true, then only return the class name if it is valid.
EX1
#include <Origin.h> #include <GetNBox.h> #include <control.h> #include <..\originlab\wkbook.h> #include <..\originlab\OriginEvents.h> #include <..\originlab\OneColheaderHandler.h> // OneColheaderHandler is a user define class here, before running, must replace with real class otherwise cannot pass compiling void OriginObject_GetEventHandler_Ex1() { Worksheet wks = Project.ActiveLayer(); if(!wks) return; Column cc(wks, 1); if(!cc) return; string strClassName = cc.GetEventHandler(true); if(!strClassName.IsEmpty()) { OneColheaderHandler& co = (OneColheaderHandler&)Project.FindClass(strClassName); if(co) { out_str("Found handler for column, invoking context menu"); int x = 0; int y = 0; //co.DoContextMenu(cc, x, y, GetWindow()); // removed } } }
OriginObject::SetEventHandler
Project::FindClass
origin.h