473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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?

Nov 17 '05 #1
1 1401
> 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_OnEventHa ndler) OnEventHandler(Myfunc); else DoMyFunction(Myfunc);


Anyone have a better sollution?
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Brian | last post by:
Hi everyone, I'm writing a function (in javascript) that needs to do one thing if the page has not loaded, and another (different) thing if the page has already loaded. I'm looking for a way...
2
by: Maziar Aflatoun | last post by:
Hi, Is there way in C# (or C#.net) to just define a function without having to initialize the class every time. For instance a function that takes a number, adds 2 and multiplies by 10. I know...
13
by: Marvin | last post by:
Hi: I have been programming with OOP and C++ for over 10 years but I am new to javascript. I am very confused about one aspect and would appreciate it if someone could explain the differences...
5
by: needin4mation | last post by:
Learning about delegates (again, I admit), I think I finally get it, maybe. I can reference any method in any class in the same namespace as long as it has the same signature. Right? But how...
19
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
3
by: =?Utf-8?B?THVib21pcg==?= | last post by:
Hi, I have an app with the main thread and one additional thread. In the main thread I defined an event handler MyHandler, the function for raisin this event OnMyEvent and the function for...
1
by: pelon | last post by:
There must be a couple of lines that will replace the following: function inside my module and execute that function in order to test it separately from the rest of the module. I know pdb will...
3
by: news.rz.uni-karlsruhe.de | last post by:
I wrote an event handler with Sys.UI.DomEvent.addHandler($get("MyButton"),"click",myfunc); function myfunc(event) { alert("Hi!"); }
2
by: =?Utf-8?B?Unlhbg==?= | last post by:
I have the following code in vs2005; line number is added for convenience: 1 private void Form1_Load(object sender, EventArgs e) 2 { 3 txtMyField.Enabled = true; 4 Form2 f = new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.