event.connect - what is event object?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

event.connect - what is event object?

aaronmevans
If I do this:

dojo.event.connect(obj1, "onFoo", obj2, "onBar");

What exactly is the "event" object that gets passed to onBar?

What can I do with it?  I am hoping I could do something like:

evt.getSource()

in order to get a reference to the object that is the source of the event.

Is there anything like that?
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: event.connect - what is event object?

jessek
Yep. That's exactly what you'll get if you specify it. (though they do add a couple fixes to the event object, but generally speaking it should look like it normally does)

On 5/1/06, Aaron Evans <[hidden email]> wrote:
If I do this:

dojo.event.connect(obj1, "onFoo", obj2, "onBar");

What exactly is the "event" object that gets passed to onBar?

What can I do with it?  I am hoping I could do something like:

evt.getSource()

in order to get a reference to the object that is the source of the event.

Is there anything like that?
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest



--
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around dojo/tapestry/tacos/hivemind.
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: event.connect - what is event object?

aaronmevans
Sorry, I don't think I understand.

I tried evt.getSource() and I get:

Error: evt.getSource is not a function
Source File: http://aaron01/dojo/src/bootstrap1.js
Line: 319

I've tried just getSource and source but nothing seems to work...

On 5/1/06, Jesse Kuhnert <[hidden email]> wrote:

> Yep. That's exactly what you'll get if you specify it. (though they do add a
> couple fixes to the event object, but generally speaking it should look like
> it normally does)
>
>
> On 5/1/06, Aaron Evans <[hidden email]> wrote:
> >
>  If I do this:
>
> dojo.event.connect(obj1, "onFoo", obj2, "onBar");
>
> What exactly is the "event" object that gets passed to onBar?
>
> What can I do with it?  I am hoping I could do something like:
>
> evt.getSource()
>
> in order to get a reference to the object that is the source of the event.
>
> Is there anything like that?
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
> --
> Jesse Kuhnert
> Tacos/Tapestry, team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: event.connect - what is event object?

iTorrey
Administrator
You can do evt.target to get the element


Aaron Evans wrote:

> Sorry, I don't think I understand.
>
> I tried evt.getSource() and I get:
>
> Error: evt.getSource is not a function
> Source File: http://aaron01/dojo/src/bootstrap1.js
> Line: 319
>
> I've tried just getSource and source but nothing seems to work...
>
> On 5/1/06, Jesse Kuhnert <[hidden email]> wrote:
>> Yep. That's exactly what you'll get if you specify it. (though they do
>> add a
>> couple fixes to the event object, but generally speaking it should
>> look like
>> it normally does)
>>
>>
>> On 5/1/06, Aaron Evans <[hidden email]> wrote:
>> >
>>  If I do this:
>>
>> dojo.event.connect(obj1, "onFoo", obj2, "onBar");
>>
>> What exactly is the "event" object that gets passed to onBar?
>>
>> What can I do with it?  I am hoping I could do something like:
>>
>> evt.getSource()
>>
>> in order to get a reference to the object that is the source of the
>> event.
>>
>> Is there anything like that?
>> _______________________________________________
>> Dojo FAQ: http://dojo.jot.com/FAQ
>> [hidden email]
>> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>>
>>
>>
>> --
>> Jesse Kuhnert
>> Tacos/Tapestry, team member/developer
>>
>> Open source based consulting work centered around
>> dojo/tapestry/tacos/hivemind.
>> _______________________________________________
>> Dojo FAQ: http://dojo.jot.com/FAQ
>> [hidden email]
>> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>>
>>
>>
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: event.connect - what is event object?

aaronmevans
In reply to this post by aaronmevans
Ah, it's evt.target.  Sweet.

Sorry if this seems like a basic JS question to most of you, but my
background is server side. ;-)

On 5/1/06, Aaron Evans <[hidden email]> wrote:

> Sorry, I don't think I understand.
>
> I tried evt.getSource() and I get:
>
> Error: evt.getSource is not a function
> Source File: http://aaron01/dojo/src/bootstrap1.js
> Line: 319
>
> I've tried just getSource and source but nothing seems to work...
>
> On 5/1/06, Jesse Kuhnert <[hidden email]> wrote:
> > Yep. That's exactly what you'll get if you specify it. (though they do add a
> > couple fixes to the event object, but generally speaking it should look like
> > it normally does)
> >
> >
> > On 5/1/06, Aaron Evans <[hidden email]> wrote:
> > >
> >  If I do this:
> >
> > dojo.event.connect(obj1, "onFoo", obj2, "onBar");
> >
> > What exactly is the "event" object that gets passed to onBar?
> >
> > What can I do with it?  I am hoping I could do something like:
> >
> > evt.getSource()
> >
> > in order to get a reference to the object that is the source of the event.
> >
> > Is there anything like that?
> > _______________________________________________
> > Dojo FAQ: http://dojo.jot.com/FAQ
> > [hidden email]
> > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> >
> >
> >
> > --
> > Jesse Kuhnert
> > Tacos/Tapestry, team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind.
> > _______________________________________________
> > Dojo FAQ: http://dojo.jot.com/FAQ
> > [hidden email]
> > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> >
> >
> >
>
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: event.connect - what is event object?

jessek
In reply to this post by aaronmevans
If the event you are looking for doesn't exist because the originating function you are listening to doesn't actually get invoked because of a native sort of mouse / keyboard event then you won't get a normal event object passed in.

It could be that you are listening to a widget function perhaps?

On 5/1/06, Aaron Evans <[hidden email]> wrote:
Sorry, I don't think I understand.

I tried evt.getSource() and I get:

Error: evt.getSource is not a function
Source File: http://aaron01/dojo/src/bootstrap1.js
Line: 319

I've tried just getSource and source but nothing seems to work...

On 5/1/06, Jesse Kuhnert <[hidden email]> wrote:

> Yep. That's exactly what you'll get if you specify it. (though they do add a
> couple fixes to the event object, but generally speaking it should look like
> it normally does)
>
>
> On 5/1/06, Aaron Evans <[hidden email]> wrote:
> >
>  If I do this:
>
> dojo.event.connect (obj1, "onFoo", obj2, "onBar");
>
> What exactly is the "event" object that gets passed to onBar?
>
> What can I do with it?  I am hoping I could do something like:
>
> evt.getSource()
>
> in order to get a reference to the object that is the source of the event.
>
> Is there anything like that?
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ

> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
> --
> Jesse Kuhnert
> Tacos/Tapestry, team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest



--
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around dojo/tapestry/tacos/hivemind.
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: event.connect - what is event object?

aaronmevans
The evt.target worked.  And I was listening to a widget event but it
was attached to an HTML element event handler, so it ended up giving
me a reference to the HTML event.

However, it would be pretty cool if you could connect to widget
handler methods and in that case the evt.target would be a reference
to the widget...



On 5/1/06, Jesse Kuhnert <[hidden email]> wrote:

> If the event you are looking for doesn't exist because the originating
> function you are listening to doesn't actually get invoked because of a
> native sort of mouse / keyboard event then you won't get a normal event
> object passed in.
>
> It could be that you are listening to a widget function perhaps?
>
>
> On 5/1/06, Aaron Evans <[hidden email] > wrote:
> >
> Sorry, I don't think I understand.
>
> I tried evt.getSource() and I get:
>
> Error: evt.getSource is not a function
> Source File: http://aaron01/dojo/src/bootstrap1.js
> Line: 319
>
> I've tried just getSource and source but nothing seems to work...
>
> On 5/1/06, Jesse Kuhnert <[hidden email]> wrote:
> > Yep. That's exactly what you'll get if you specify it. (though they do add
> a
> > couple fixes to the event object, but generally speaking it should look
> like
> > it normally does)
> >
> >
> > On 5/1/06, Aaron Evans <[hidden email]> wrote:
> > >
> >  If I do this:
> >
> > dojo.event.connect (obj1, "onFoo", obj2, "onBar");
> >
> > What exactly is the "event" object that gets passed to onBar?
> >
> > What can I do with it?  I am hoping I could do something like:
>  >
> > evt.getSource()
> >
> > in order to get a reference to the object that is the source of the event.
> >
> > Is there anything like that?
> > _______________________________________________
>  > Dojo FAQ: http://dojo.jot.com/FAQ
> > [hidden email]
> > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> >
> >
> >
> > --
> > Jesse Kuhnert
> > Tacos/Tapestry, team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind.
> > _______________________________________________
> > Dojo FAQ: http://dojo.jot.com/FAQ
> > [hidden email]
> > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> >
> >
> >
> _______________________________________________
>
> Dojo FAQ: http://dojo.jot.com/FAQ
> [hidden email]
>  http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
>
> --
> Jesse Kuhnert
> Tacos/Tapestry, team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
_______________________________________________
Dojo FAQ: http://dojo.jot.com/FAQ
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest