Date: Sat, 29 Apr 2000 13:57:29 GMT
Reply-To: Aswin <A.Bouwmeester@INTER.NL.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Aswin <A.Bouwmeester@INTER.NL.NET>
Organization: UUNET-NL (http://www.nl.uu.net)
Subject: SAS V8 - setting event handlers programmaticly
Hi,
I'm trying to set event handlers programmaticly using the
_addEventHandler or _setEventHandler methods. Whatever method
signature I try, this does not seem to work. Is ther anybody out there
that has done this succesfully or might be able to see what I do
wrong?
Here is some of he code I used. This is part of a model that should
trap all events generated by a given component.
After calling this method a queried the model using _getEventHandlers
to find out if the events were registered. This was only true when
using the _addEventHandler(metadata) method. Although the events were
registered they were not trapped.
When setting event handlers using the properties window all works
fine.
Aswin Bouwmeester
listenTo:
Method id: object;
l_events=MAKELIST();
IF NOT id._getEvents(l_events,'Yes') THEN DO;
DO q=1 TO LISTLEN(l_events);
l_event=GETITEML(l_events,q);
/*
* Try the _addEventHandler(o,c,c) method;
return = _self_._addEventHandler( id,
GETNITEMC(l_event,'name'), "onEvent" );
*/
* Try the _addEventHandler(metadata) method;
list=MAKELIST();
rc=SETNITEMC(list,'N','state');
rc=SETNITEMC(list,id.name,'sender');
rc=SETNITEMC(list,GETNITEMC(l_event,'name'),'event');
rc=SETNITEMC(list,"onEvent",'method');
rc=SETNITEMC(list,"none",'description');
rc=SETNITEMC(list,"y",'enabled');
return = _self_._addEventHandler(list);
rc=DELLIST(list);
/*
* Try the _setEventHandler method;
rc=_self_._setEventHandler(id,GETNITEMC(l_event,'name'),'onEvent(*)',_self_);
*/
/*
* Legacy style;
CALL SEND (_self_, '_SET_EVENT_HANDLER_',
id,GETNITEMC(l_event,'name') , 'onEvent(*)', _self_ );
*/
END;
END;
rc=DELLIST(l_events,'Y');
EndMethod;