OK, I've done this, but it still isn't achieving what I want.
Maybe I've got the wrong idea - I'm expecting this event to trigger when I
click anywhere on the page except for my widget. Am I going about this in
the wrong way? I thought that DynAPI.document represented the same object as
usual JavaScript document object?
Cheers, Ben
----- Original Message -----
From: "Robert Rainwater" <[EMAIL PROTECTED]>
To: "Ben Empson" <[EMAIL PROTECTED]>
Sent: Thursday, April 19, 2001 3:14 AM
Subject: Re: [Dynapi-Help] Catching events on the document
>
> DynAPI.document is not intialized until the page is loaded so you need
> to put all of that code inside of the DynAPI.onLoad function.
>
> --
> Robert Rainwater
>
>
> On 4/18/2001, 7:07:33 PM EST, Ben wrote about "[Dynapi-Help] Catching
events on the document":
>
> > I am building a select list widget, and I wish to catch the mousedown
event on the document, in order to close the select box if it is open. I
have tried the following code, but I get an error
> > saying 'DynAPI.document is null or not an object' (referring to the
first line of the EventListener).
>
> > This doesn't make since I have already added my select list widget to
the DynAPI.document object as a child (haven't I?!!!)
>
> > Any help appreciated, Ben
>
> > -------------------code start---------------------
>
> > <script language="JavaScript"
src="../dynapi2_51/dynapi/src/dynapi.js"></script>
> > <script language="Javascript">
>
> > DynAPI.setLibraryPath('../dynapi2_51/dynapi/src/lib/');
>
> > DynAPI.include('dynapi.api.*');
> > DynAPI.include('dynapi.event.*')
> > DynAPI.include('dynapi.gui.label.js')
> > DynAPI.include('dynapi.gui.list.js')
> > DynAPI.include('dynapi.util.thread.js')
> > DynAPI.include('dynapi.util.pathanim.js');
> > DynAPI.include('selectList.js','./')
>
> > DynAPI.onLoad=function() {
> > select1 = new selectList('test')
> > DynAPI.document.addChild(select1)
> > }
>
> > DynAPI.document.events = new EventListener(DynAPI.document)
> > DynAPI.document.onmousedown=function(e){
> > alert('test')
> > }
> > DynAPI.document.addEventListener(DynAPI.document.events)
>
> > </script>
>
> > --------------------code end----------------------------
>
>
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help