473,396 Members | 1,738 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.

Multiple Event Handlers for Single Event

Hi All,

I have an issue where I'd like a single global event to be handled by
multiple event handlers. In this case, I would like a "global" (static) Menu
Item that I create in a class, and I'd like the controls that use this menu
to each react to its Click event.

Perhaps I've been spending too much time in the sun?

Thanks,
pagates
Jul 24 '06 #1
2 2303
Pagates,

This isn't a good idea from a design perspective. If you have a
MenuItem, then it most surely has to be attached to a menu, either a context
menu, or a menu on a form. Regardless, the event should be scoped to these
instances, not globally.

What exactly are you trying to do?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.comwrote in message
news:D7**********************************@microsof t.com...
Hi All,

I have an issue where I'd like a single global event to be handled by
multiple event handlers. In this case, I would like a "global" (static)
Menu
Item that I create in a class, and I'd like the controls that use this
menu
to each react to its Click event.

Perhaps I've been spending too much time in the sun?

Thanks,
pagates

Jul 24 '06 #2
Hi Nicholas,

I have a number of controls that contain ListViews. Some of these controls
are seen at the same time. The requirement is that there is a context menu
item that allows the user to choose (globally) whether certain columns are
visible. One menu selection needs to update all the lists on all the
controls.

I know that I could have a separate context menu in each control, have it
fire an event to the wrapper control, which in turn would set a property or
call a method to set the visible columns in each of the other controls, but
that seems risky too (for instance, if the choices are changed down the road,
etc.). It seems like a central event could be "cleaner".

Thanks,
PAGates
"Nicholas Paldino [.NET/C# MVP]" wrote:
Pagates,

This isn't a good idea from a design perspective. If you have a
MenuItem, then it most surely has to be attached to a menu, either a context
menu, or a menu on a form. Regardless, the event should be scoped to these
instances, not globally.

What exactly are you trying to do?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.comwrote in message
news:D7**********************************@microsof t.com...
Hi All,

I have an issue where I'd like a single global event to be handled by
multiple event handlers. In this case, I would like a "global" (static)
Menu
Item that I create in a class, and I'd like the controls that use this
menu
to each react to its Click event.

Perhaps I've been spending too much time in the sun?

Thanks,
pagates


Jul 24 '06 #3

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

Similar topics

13
by: jing_li | last post by:
Hi, you all, I am a newbee for php and I need your help. One of my coworker and I are both developing a webpage for our project using php. We have a copy of the same files in different location...
15
by: Iced Crow | last post by:
In C# I know that you can use delegates to assing multiple addresses of sub and functions to a delegate and have it fire multiple procedures... How do I do this in VB? I only know of assigning...
4
by: Lars Netzel | last post by:
Is there any way to add some code that will happen in every single Event that i raised in a form? I have a Total field in the bottom of a pretty complex page and I think it's kind of "Dirty" to...
3
by: Brian | last post by:
Hi, All, I want to create a single user control (component) with multi-controls. for example, I want to use one button control and 2 listBox controls to build one single user control. so, user...
6
by: Peter M. | last post by:
Hi all, If an event has multiple subscribers, is it possible to cancel the invocation of event handlers from an event handler? Or to be more specific: I'm subscribing to the ColumnChanging...
6
by: Jake K | last post by:
Where is the best place to define event handlers? I need to define event handlers for a COM object referenced in my project and am doing so in the fowm load. Is this the best place?
1
by: Christian Sengstock | last post by:
Hi all, i have a js application with several event handlers which i manage via prototype .bindAsEventListener. On normal page navigation ( link navigation ) i finish all events handlers...
7
by: Dom | last post by:
In CSharp, can you have multiple handlers for a single event? For example, for a textbox TextChanged event, can I have two separate handlers called up? I have 4 text boxes, and the TextChanged...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.