SOS - Click Events in .NET - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Microsoft Windows and Software
Click Here to Login
Closed Thread
Thread Tools Display Modes
Old 02-14-2005, 03:47 PM   #1 (permalink)
Newb Techie
Join Date: Feb 2005
Posts: 11
Default SOS - Click Events in .NET

Here's something I wish to learn about how Windows OS interacts with .NET:

Every Windows Forms Control has the ability to handle one or more mouse actions - left click, double click etc. ( For example, .NET allows this by generating a Click event for the relevant control everytime the mouse is left clicked.

What I wish to understand is that how does .NET know which Control to generate the Click event for. In other words, if I click on a particular button, the OS recognizes the point on the screen where the click occurs, then translates that information and sends it to .NET which identifies which control does the click correspond to. That, at least, I believe is the chronology.

It'll be great if someone can help me understand this translation between the OS and the .NET. Any help is greatly appreciated.



sarabjit is offline  
Old 02-15-2005, 04:48 PM   #2 (permalink)
Newb Techie
Join Date: Feb 2005
Posts: 11

Some more info..

Here's as far as I've been able to get. The following is the chronology of actions that take place after a click:

Step 1. mouse is clicked

Step 2. windows detects the mouse click through the driver, and sends the input to the relevant process

Step 3. the OnEventName() method of the respective control in the process is called along with the event data as the argument
the definition of each Forms.Control class already consists of a definition for this method; the user does not need to worry about including it in his/her application

Step 4. the OnEventName() method references the respective delegate
delegates for different event handlers for any Forms.Control are also automatically added to the corresponding instances by .NET directly

Step 5. the delegate then makes a call to the event handler written by the user
this is the event handler which describes what should happen when the event occurs; this is also the method which needs to have the same signature as the corresponding delegate it uses

The missing pieces of information are in:
Step 2: What determines the choice of the relevant process?
Step 3: What determines the choice of the relevant control in the process?

Any clues?
sarabjit is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 02:58 PM.

Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.