Click here to Skip to main content
16,007,126 members
Home / Discussions / C#
   

C#

 
GeneralIOCP in .NET Pin
BestSnowman4-Apr-03 14:06
BestSnowman4-Apr-03 14:06 
GeneralRe: IOCP in .NET Pin
Alex Korchemniy5-Apr-03 8:52
Alex Korchemniy5-Apr-03 8:52 
GeneralRe: IOCP in .NET Pin
James T. Johnson5-Apr-03 13:45
James T. Johnson5-Apr-03 13:45 
QuestionHow to call the default event handler? Pin
Alvaro Mendez4-Apr-03 11:51
Alvaro Mendez4-Apr-03 11:51 
AnswerRe: How to call the default event handler? Pin
neroknights4-Apr-03 12:00
neroknights4-Apr-03 12:00 
GeneralRe: How to call the default event handler? Pin
Alvaro Mendez4-Apr-03 12:27
Alvaro Mendez4-Apr-03 12:27 
GeneralRe: How to call the default event handler? Pin
neroknights7-Apr-03 5:08
neroknights7-Apr-03 5:08 
AnswerRe: How to call the default event handler? Pin
James T. Johnson5-Apr-03 13:21
James T. Johnson5-Apr-03 13:21 
Alvaro Mendez wrote:
would like it to do nothing in some circumstances -- in other words I want it to just call the parent's event handler.

The pattern Microsoft uses (in all instances I know of) is the following:

Class Foo exposes an event named Bar, Foo also has a protected method called OnBar. OnBar does two different things, one is a side-effect of the other.

First, in the class that defines the event OnBar can include some processing but to my knowledge they just fire the event, leaving the processing to however that class calls OnBar. The Bar event is fired from within OnBar because events can only be fired while operating within the class that defines it, anywhere else you can only add or remove handlers.

The second thing that OnBar does is allow you to handle the Bar event without having to hookup another event handler, reducing a little overhead (though not much).

Because OnBar should only fire the event, you can also call OnBar yourself to fire the event outside of normal circumstances.

Another thing to note is that events (for the most part) are notifiers that something has happened so you can only respond to that thing happening. As you suggest later, in order to prevent the Click event from firing in certain circumstances you need to go to the source, the OnClick method, and not call base.OnClick in those cases.

Hope that makes some sense to you, my thoughts have been jumbled a bit lately.

James

"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation

QuestionHow would I make a button act like a ReadLine method Pin
Ioncycle4-Apr-03 10:05
Ioncycle4-Apr-03 10:05 
GeneralClass inheritance issue with XmlNodeList Pin
econner4-Apr-03 9:35
econner4-Apr-03 9:35 
GeneralRe: Class inheritance issue with XmlNodeList Pin
neroknights4-Apr-03 12:09
neroknights4-Apr-03 12:09 
GeneralGetting the FQDN of the host Pin
Arun Bhalla4-Apr-03 9:33
Arun Bhalla4-Apr-03 9:33 
GeneralClass Design Question Pin
Mark Sanders4-Apr-03 4:46
Mark Sanders4-Apr-03 4:46 
GeneralRe: Class Design Question Pin
Philip Fitzsimons4-Apr-03 4:53
Philip Fitzsimons4-Apr-03 4:53 
GeneralRe: Class Design Question Pin
Mark Sanders4-Apr-03 4:59
Mark Sanders4-Apr-03 4:59 
GeneralRe: Class Design Question Pin
Philip Fitzsimons4-Apr-03 5:09
Philip Fitzsimons4-Apr-03 5:09 
GeneralRe: Class Design Question Pin
Ranjan Banerji4-Apr-03 7:03
Ranjan Banerji4-Apr-03 7:03 
GeneralRe: Class Design Question Pin
Mark Sanders4-Apr-03 7:51
Mark Sanders4-Apr-03 7:51 
GeneralRe: Class Design Question Pin
Nnamdi Onyeyiri4-Apr-03 8:01
Nnamdi Onyeyiri4-Apr-03 8:01 
GeneralRespond to UI Messages Pin
Roger CS4-Apr-03 3:41
Roger CS4-Apr-03 3:41 
GeneralRe: Respond to UI Messages Pin
neroknights4-Apr-03 4:06
neroknights4-Apr-03 4:06 
GeneralRe: Respond to UI Messages Pin
Nick Seng6-Apr-03 16:45
Nick Seng6-Apr-03 16:45 
GeneralRe: Respond to UI Messages Pin
neroknights7-Apr-03 5:12
neroknights7-Apr-03 5:12 
GeneralRe: Respond to UI Messages Pin
Nick Seng7-Apr-03 16:12
Nick Seng7-Apr-03 16:12 
GeneralRe: Respond to UI Messages Pin
neroknights8-Apr-03 4:04
neroknights8-Apr-03 4:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.