By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,187 Members | 1,594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,187 IT Pros & Developers. It's quick & easy.

what is an event?

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
> > 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

P: n/a

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

P: n/a
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.