470,590 Members | 2,521 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,590 developers. It's quick & easy.

what is an event?

i used mouseEvents or clickEvents etc.. but i did not still understand what
an event is yet.

eg: when we press a button, the eventhandler registered with the the
button's click *event* is invoked. what is "button's click event" here?
or can we write this event from scratch?

eg: we have an integer , say i. incrementing the i , i++ . could this be an
event too?
i mean, can we invoke a function (or a eventhandler), when i is incremented?
Nov 16 '05 #1
4 1167
e-mid <yy@ss.com> wrote:
i used mouseEvents or clickEvents etc.. but i did not still understand what
an event is yet.

eg: when we press a button, the eventhandler registered with the the
button's click *event* is invoked. what is "button's click event" here?
or can we write this event from scratch?
An event is basically a delegate which is exposed to the outside world
in such a way that other classes can only add delegates to it and
remove them. At some point or other, the class which contains the event
can then fire/raise it by executing the delegates which have subscribed
to it.
eg: we have an integer , say i. incrementing the i , i++ . could this be an
event too?
No.
i mean, can we invoke a function (or a eventhandler), when i is incremented?


No.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
> > i mean, can we invoke a function (or a eventhandler), when i is
incremented?

No. Well you could, if 'i' was a property, and on the set code you can invoke an
event to say it's been modified.

--
John Wood
EMail: first name, dot, second name at priorganize.com
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... e-mid <yy@ss.com> wrote:
i used mouseEvents or clickEvents etc.. but i did not still understand what an event is yet.

eg: when we press a button, the eventhandler registered with the the
button's click *event* is invoked. what is "button's click event" here? or can we write this event from scratch?
An event is basically a delegate which is exposed to the outside world
in such a way that other classes can only add delegates to it and
remove them. At some point or other, the class which contains the event
can then fire/raise it by executing the delegates which have subscribed
to it.
eg: we have an integer , say i. incrementing the i , i++ . could this be an event too?


No.
i mean, can we invoke a function (or a eventhandler), when i is

incremented?
No.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #3

e-mid,

To put it in layman terms,

event is the place where you get control in your code, based on user's
action.

The common user actions are,

1. moving or clicking mouse
2. playing with keyboard

If you want to do something as soon as the user completed the above
operation, event is the best place to put ur code becoz you can get control
immediately and will know some basic parameters. For example, during
keyboard events, you will get some useful information like, which "key" has
been pressed.

Shak.
"e-mid" <yy@ss.com> wrote in message
news:#g**************@TK2MSFTNGP10.phx.gbl...
i used mouseEvents or clickEvents etc.. but i did not still understand what an event is yet.

eg: when we press a button, the eventhandler registered with the the
button's click *event* is invoked. what is "button's click event" here? or can we write this event from scratch?

eg: we have an integer , say i. incrementing the i , i++ . could this be an event too?
i mean, can we invoke a function (or a eventhandler), when i is incremented?

Nov 16 '05 #4
thnkz all..

"e-mid" <yy@ss.com> wrote in message
news:#g**************@TK2MSFTNGP10.phx.gbl...
i used mouseEvents or clickEvents etc.. but i did not still understand what an event is yet.

eg: when we press a button, the eventhandler registered with the the
button's click *event* is invoked. what is "button's click event" here? or can we write this event from scratch?

eg: we have an integer , say i. incrementing the i , i++ . could this be an event too?
i mean, can we invoke a function (or a eventhandler), when i is incremented?

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by J Sharman | last post: by
3 posts views Thread by Brett | last post: by
3 posts views Thread by David Logan | last post: by
12 posts views Thread by Nathan Sokalski | last post: by
9 posts views Thread by Jay | last post: by
7 posts views Thread by amit | last post: by
11 posts views Thread by antonyliu2002 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.