It's an object that allows you to find out where the 'event' came from. (and
other event stuff; setBubble() controls the browser's event bubbling; very
cool as they say)
(it's a DynEvent look in 'listeners.js')
I use it this way:
      this.fndbutListener = new EventListener(this);
where 'this' is derived from DynLayer, it is my class (my widget).
I have created buttons in my class, and want to know 2 things when the event
occurrs.
1) what button caused the event.
2) what object is using this event (this) so that I can pass any information
through the object's data structure, to an event handler.
When the event fires, it calls the 'onmousedown' function, but that function
needs to find out what the context is ( the button and the object from 'e')
Then I do:
            this.fndbut[i].addEventListener(this.fndbutListener);
I have an array of buttons (fndbut) and use one EventListener for all of
them.
In this case e.getSource() gives the button object reference, and
e.getTarget() give the reference to 'this' which is the object containing
the button.

Another thing I'm doing in functions (not objects) is this:
foo = function() {
  var list = new List();
// set up the List...
  var fListener = new EventListener(document reference such as new
DynDocument(frame))
    fListener.onselect=function(e) {
       var item = list.getSelectedItem();
    }
    list.addEventListener(fListener)
}
In this case I don't need to use 'e', because the function is defined inside
of 'foo()', so it has access to 'list' in it's scope, so it can get the
information from the List.
make sense? If not I'm not surprised...it barely makes sense to me.

Now onto my own troubles.
Todd.


----- Original Message -----
From: "James Musick" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 10, 2002 7:33 PM
Subject: [Dynapi-Help] what does is the 'e' in function(e)


>
>   This is probably really simple, and it's used all over the place, but
it's
> stumping me right now....
>
>   For example in the examples on sourceforge
> http://dynapi.sourceforge.net/doccenter/index.php?EventListeners
>
> myListener=new EventListener(myLayer)
> myListener.onmouseover=function(e) {
> target=e.getTarget()
> target.setBgColor('#0000f0')
> }
>
> What is the object e?
> And where is getting the setTarget() method?
> myListener1.onmousedown=function(e)
>     {
>     e.setBubble(false)
>     }
> seems to be another common use.
>
> Thanks for an explanation...
>
>   -J
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Two, two, TWO treats in one.
> http://thinkgeek.com/sf
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dynapi-help
>



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
PC Mods, Computing goodies, cases & more
http://thinkgeek.com/sf
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to