__event handler test: if (OnEventHandler) OnEventHandler(Myfunc);

G

Guest

I want to hook events handlers but need to test of any event handler is
assigned or not.

I need something like this:

__event void OnEventHandler(Myfunc)
....
if (OnEventHandler) OnEventHandler(Myfunc);
else DoMyFunction(Myfunc);
....

This "if (OnEventHandler)" does not get accepted by unmanaged C++ 2002.
Any tips how to test this?

In Delphi this was possible.

I do know that it is a list.
Maybe somthing like "if (OnEventHandler.Count>0)" could do the trick?
 
G

Guest

I want to hook events handlers but need to test of any event handler is
assigned or not.

I need something like this:

__event void OnEventHandler(Myfunc)
...
if (OnEventHandler) OnEventHandler(Myfunc);
else DoMyFunction(Myfunc);
...

One (dirty) sollution is:
if (__eventHandlerList_MyNameSpace_CMyClass_OnEventHandler) OnEventHandler(Myfunc);
else DoMyFunction(Myfunc);

Anyone have a better sollution?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top