Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Difference between an event and a function

1,479 views
Skip to first unread message

Asif Anwar

unread,
Jun 23, 2000, 3:00:00 AM6/23/00
to
I am a starter and wanted to know the difference between an event and a
function.

Asif

Jim O'Neil [Sybase]

unread,
Jun 23, 2000, 3:00:00 AM6/23/00
to
Three of the biggest differences:

Events cannot be overloaded.

Events fire from ancestor on down, functions fire on the lowest level
of the inheritance hierarchy for which they are found. So if you have
object A and B and B inherits from A, A has event X and function Y and
B has event X and function Y. Then when event X occurs on B, it runs
through the code of event X on A first (by default, and this can be
changed). If function Y is callled on B, function Y on A does not
execute (unless you explicitly tell it to). If B didn't have function
Y, then it would be run on A.

Events fail silently, functions do not. This applies to dynamic calls
using the DYNAMIC keyword. This allows you to make calls to objects
that are resolved at runtime versus compile time. If you set up to
trigger or post an event that at run time is found not to exist on the
intended object, it will fail without error, if you do this with a
function you will get a runtime error.

Jim O'Neil
Sybase Technical Support

DawnBrownEyes[TeamSybase]

unread,
Jun 25, 2000, 3:00:00 AM6/25/00
to
ditto jim
Also
An event is usually a notification that something has occurred. clicked,
modified, open...
A function is processing that occurs. A function is usually called from an
event. .

You can code processing in an event but it is recommended to put it in a
function and call it from an event.

--
Dawn T Brown Eyes (TeamSybase)


Asif Anwar <anwar...@netscape.net> wrote in article
<07riC5T3$GA....@forums.sybase.com>...

Edo Papai

unread,
Jun 26, 2000, 3:00:00 AM6/26/00
to
Also
When you are declaring function you can specify acces level to the function
/which scripts have acces/. Acces can be
public, private, protected. You can't specify acces to events, there are
always public.

Edo Papai
epa...@softip.sk

Jerry Siegel

unread,
Jun 26, 2000, 3:00:00 AM6/26/00
to
You can invoke an event whose name is not known until run time with the
PostEvent and TriggerEvent functions, and if the event does not exist the
function returns -1. The downside to this older method is that you will be
limited to the system arguments word and long rather than being able to
declare your own arguments for the event.

Jim O'Neil [Sybase] wrote in message
<3953e312...@forums.powersoft.com>...

0 new messages