The GW-Scripting list is a discussion list for information regarding the development and use of Window-Eyes scripts. Any subscriber of the GW-Scripting list has the ability to post on-topic messages.
From:
"Chip Orange" <lists3717@comcast.net>Subject:
RE: Connecting to multiple events?Date:
Wed, Jun 13, 2012 10:34:12 amThis is a multi-part message in MIME format.
------=_NextPart_000_0024_01CD4950.12FAF3A0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hi David,
Sure, there's no problem in having a single handler handle more than one
type of event; in real life things never happen "at the same time"; there's
always one which happens first, and the others will wait (that's true even
if you had separate event handlers).
The only restriction is that the parameter list must be the same for the two
types of events, and they require the same type of handler (either a sub or
a function).
It should be obvious, but you cannot have an event which requires a sub with
one parameter, and a second which requires a function with two parameters,
be handled by the same routine.
You've also got the question: can you tell which type of event just called
the handler? Often you cannot, and you'll need separate routines just for
that reason.
hth,
Chip
_____
From: David [mailto:elephant@tele2.no]
Sent: Wednesday, June 13, 2012 10:24 AM
To: gw-scripting@gwmicro.com
Subject: Connecting to multiple events?
Something crossed my mind today. A bit of a techie question.
If I, in a script connect to multiple events, but want the same sub or
function to be executed when any of the events take place. Kind of:
ConnectEvent ObjectName, "Event1", "happening"
ConnectEvent ObjectName, "Event2", "happening"
Function Happening()
Speak "something has happened."
End Function 'Happening.
Long as either of the events 1 or 2 takes place at different times, I guess
the above code would work. (sure, with real names, of course.) But what if
the two events take place at the same time? Is there any "life-line" that
secures that events don't fire simultaneously? I guess not. So in a case
like above, will I actually have to make two different eventHandling
functions, with the exact same content (good thing we have copy and paste,
smile)? Or, is there a safe way of handling a situation like this, with one
"common" EventHandler?
Thanks for any input.
------=_NextPart_000_0024_01CD4950.12FAF3A0
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19272">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>Hi David,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>Sure, there's no problem in having a single handler handle
more than one type of event; in real life things never happen "at the same
time"; there's always one which happens first, and the others will wait (that's
true even if you had separate event handlers).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>The only restriction is that the parameter list must be the
same for the two types of events, and they require the same type of handler
(either a sub or a function).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>It should be obvious, but you cannot have an event which
requires a sub with one parameter, and a second which requires a function with
two parameters, be handled by the same routine.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>You've also got the question: can you tell which type of event
just called the handler? Often you cannot, and you'll need separate
routines just for that reason.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>hth,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>Chip</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> David [mailto:elephant@tele2.no]
<BR><B>Sent:</B> Wednesday, June 13, 2012 10:24 AM<BR><B>To:</B>
gw-scripting@gwmicro.com<BR><B>Subject:</B> Connecting to multiple
events?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT size=2 face=Arial>Something crossed my mind today. A bit of a
techie question.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>If I, in a script connect to multiple events, but
want the same sub or function to be executed when any of the events take
place. Kind of:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>ConnectEvent ObjectName, "Event1",
"happening"</FONT></DIV>
<DIV><FONT size=2 face=Arial>ConnectEvent ObjectName, "Event2",
"happening"</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Function Happening()</FONT></DIV>
<DIV><FONT size=2 face=Arial> Speak "something has
happened."</FONT></DIV>
<DIV><FONT size=2 face=Arial>End Function 'Happening.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Long as either of the events 1 or 2 takes place
at different times, I guess the above code would work. (sure, with real names,
of course.) But what if the two events take place at the same time? Is there
any "life-line" that secures that events don't fire simultaneously? I guess
not. So in a case like above, will I actually have to make two different
eventHandling functions, with the exact same content (good thing we have copy
and paste, smile)? Or, is there a safe way of handling a situation like this,
with one "common" EventHandler?</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Thanks for any input.</FONT></DIV>
<DIV> </DIV></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0024_01CD4950.12FAF3A0--
------=_NextPart_000_0024_01CD4950.12FAF3A0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hi David,
Sure, there's no problem in having a single handler handle more than one
type of event; in real life things never happen "at the same time"; there's
always one which happens first, and the others will wait (that's true even
if you had separate event handlers).
The only restriction is that the parameter list must be the same for the two
types of events, and they require the same type of handler (either a sub or
a function).
It should be obvious, but you cannot have an event which requires a sub with
one parameter, and a second which requires a function with two parameters,
be handled by the same routine.
You've also got the question: can you tell which type of event just called
the handler? Often you cannot, and you'll need separate routines just for
that reason.
hth,
Chip
_____
From: David [mailto:elephant@tele2.no]
Sent: Wednesday, June 13, 2012 10:24 AM
To: gw-scripting@gwmicro.com
Subject: Connecting to multiple events?
Something crossed my mind today. A bit of a techie question.
If I, in a script connect to multiple events, but want the same sub or
function to be executed when any of the events take place. Kind of:
ConnectEvent ObjectName, "Event1", "happening"
ConnectEvent ObjectName, "Event2", "happening"
Function Happening()
Speak "something has happened."
End Function 'Happening.
Long as either of the events 1 or 2 takes place at different times, I guess
the above code would work. (sure, with real names, of course.) But what if
the two events take place at the same time? Is there any "life-line" that
secures that events don't fire simultaneously? I guess not. So in a case
like above, will I actually have to make two different eventHandling
functions, with the exact same content (good thing we have copy and paste,
smile)? Or, is there a safe way of handling a situation like this, with one
"common" EventHandler?
Thanks for any input.
------=_NextPart_000_0024_01CD4950.12FAF3A0
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19272">
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>Hi David,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>Sure, there's no problem in having a single handler handle
more than one type of event; in real life things never happen "at the same
time"; there's always one which happens first, and the others will wait (that's
true even if you had separate event handlers).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>The only restriction is that the parameter list must be the
same for the two types of events, and they require the same type of handler
(either a sub or a function).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>It should be obvious, but you cannot have an event which
requires a sub with one parameter, and a second which requires a function with
two parameters, be handled by the same routine.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>You've also got the question: can you tell which type of event
just called the handler? Often you cannot, and you'll need separate
routines just for that reason.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>hth,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial>Chip</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=671582814-13062012><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> David [mailto:elephant@tele2.no]
<BR><B>Sent:</B> Wednesday, June 13, 2012 10:24 AM<BR><B>To:</B>
gw-scripting@gwmicro.com<BR><B>Subject:</B> Connecting to multiple
events?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT size=2 face=Arial>Something crossed my mind today. A bit of a
techie question.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>If I, in a script connect to multiple events, but
want the same sub or function to be executed when any of the events take
place. Kind of:</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>ConnectEvent ObjectName, "Event1",
"happening"</FONT></DIV>
<DIV><FONT size=2 face=Arial>ConnectEvent ObjectName, "Event2",
"happening"</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Function Happening()</FONT></DIV>
<DIV><FONT size=2 face=Arial> Speak "something has
happened."</FONT></DIV>
<DIV><FONT size=2 face=Arial>End Function 'Happening.</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Long as either of the events 1 or 2 takes place
at different times, I guess the above code would work. (sure, with real names,
of course.) But what if the two events take place at the same time? Is there
any "life-line" that secures that events don't fire simultaneously? I guess
not. So in a case like above, will I actually have to make two different
eventHandling functions, with the exact same content (good thing we have copy
and paste, smile)? Or, is there a safe way of handling a situation like this,
with one "common" EventHandler?</FONT></DIV>
<DIV><FONT size=2 face=Arial></FONT> </DIV>
<DIV><FONT size=2 face=Arial>Thanks for any input.</FONT></DIV>
<DIV> </DIV></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0024_01CD4950.12FAF3A0--




