473,320 Members | 2,052 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,320 software developers and data experts.

Swapping of event handlers

Hi,

I want to replace an event handler on an outside control with a new handler,
and then later swap back to the old handler again... Is there any way to do
it? (I'll have to store the old handler, but how on earth can I do it?)

If it may help, what I want to do is the following: I have a GIS map, and I
want to create a few tools that can be used on the map. When you activate a
specific tool, the mouse up, down move events must be processed by my tool,
and any other handlers in the "main" code must not be executed. When the
tool is deactivated, the old handlers must be hooked up again.

I can add my own handler with +=, and remove it again afterwards (-=), but I
don't know how to "save" the existing events in the collection (I suppose it
is an event collection)?

Thanks
Jan
Nov 17 '05 #1
1 1302
I would crate a control which inherits form the one you are working on.

Then override onMouseDown().

An event will be raised only if inside onMouseDown() you call
base.onMouseDown(...).

Cheers

"Jan van Schalkwyk" <ja*@leavethisout.fouriersystems.co.za> wrote in message
news:Ol**************@TK2MSFTNGP15.phx.gbl...
Hi,

I want to replace an event handler on an outside control with a new
handler, and then later swap back to the old handler again... Is there any
way to do it? (I'll have to store the old handler, but how on earth can I
do it?)

If it may help, what I want to do is the following: I have a GIS map, and
I want to create a few tools that can be used on the map. When you
activate a specific tool, the mouse up, down move events must be processed
by my tool, and any other handlers in the "main" code must not be
executed. When the tool is deactivated, the old handlers must be hooked
up again.

I can add my own handler with +=, and remove it again afterwards (-=), but
I don't know how to "save" the existing events in the collection (I
suppose it is an event collection)?

Thanks
Jan

Nov 17 '05 #2

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

Similar topics

10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
8
by: Dennis C. Drumm | last post by:
I have a class derived from a SortedList called SystemList that contains a list of objects indexed with a string value. The definition of the objects contained in the SortedList have a boolean...
18
by: bhavin | last post by:
Hi, Can someone point me to some good best practices kind of documentation on use of events compared to method overriding. Ex. In Windows Forms when should i have an event handler for Paint, and...
13
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the...
5
by: Amit | last post by:
Hello! Is it possible to find how many event handlers an event has at runtime? How about finding whether or not an event has event handlers? In C# you can compare the event with null to check if...
6
by: Kevin Attard | last post by:
I am using a GridView inside a UserControl which has a template column for deleting the rows. Before databinding the gridview i am attaching the RowCommand and RowDataBound event. I am using the...
16
by: Hamed | last post by:
Hello I am developing a utility to be reused in other programs. It I have an object of type Control (a TextBox, ComboBox, etc.) that other programmers use it in applications. they may set some...
14
by: Hamed | last post by:
Hello It seems that I should implement ICloneable to implement my own clone object. the critical point for me is to make a control object based on another control object that all of its event...
6
by: Tony Johansson | last post by:
Hello! I know it's possible to have several event handler for a single event but I can't see any point using several event handler for this. I'm probably wrong so can anybody tell me what...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.