Michael, I'd have no objections to a DynLayer.setTextSelectable() method - just not 
setSelectable() cause I'm using it widgets sometimes.  For stopping the right mouse 
"context menu", we could create a new event on DynDocument - "oncontextmenu" and 
disable the default action whenever that event is listened for.

I was not able to get synchronous loading working in IE 5, even with the "defer" value 
set to true or false.  And it's not going to work in NS4 also.  When using 
createElement('script'), the first time you load a script and immediately call a 
function contained in it, it fails.  The second time you load it it works.  I had to 
wait for the "onreadystatechange" event to call in order to get around it.

As far as I see there's going to be no other option but going with asynchronous 
loading.  The way I handled it is to create a proper dependency list before trying to 
load an object.  It would be nicer to let each object define it's own requirements but 
without synchronous loading it just isn't possible without a VERY "confusing web of 
intermediate methods" :).  So I'm going with the easy cop-out solution.

When you "add()" an object to the library tree it simply ensures that any objects that 
are required by the script are loaded before it:

DynAPI.library.add('DependentObj','dep.src');
DynAPI.library.add('Obj','obj.js','DependentObj');
DynAPI.library.load('Obj');  // loads DependentObj before Obj

For the dynapi core files, we'll include a ready made dependency list:

DynAPI.library.add(['DynEvent','EventObject','DynElement'],DynAPI.libraryPath+'dynapi/api/event.js');
DynAPI.library.add(['DynDocument'],DynAPI.libraryPath+'dynapi/api/dyndocument.js',['DynEvent']);
DynAPI.library.add(['DynLayer'],DynAPI.libraryPath+'dynapi/api/dynlayer.js',['DynDocument']);
DynAPI.library.add(['MouseEvent'],DynAPI.libraryPath+'dynapi/api/mouse.js',['DynLayer']);

So in a page you'd just do this to load everything up:

DynAPI.library.load('MouseEvent', function() {
   alert(MouseEvent+' '+DynLayer);
});

I'll also add object grouping so that you can also do:

DynAPI.library.load('DynAPI.api');

And also with that, we can attach the constructors to the DynAPI.api object:

DynAPI.api.DynLayer = DynLayer;

This will be useful in cases where you're working with frames and windows that are 
opened from a frame containing DynAPI.  You could just open up a window and call the 
following inside it:

var DynAPI = window.opener.DynAPI;
var doc = new DynAPI.api.Document(this);
var lyr = doc.addChild(new DynAPI.api.DynLayer());

Or even better it would be easy to rescope the objects to that frame, maybe something 
like this:

var DynAPI = window.opener.DynAPI;
DynAPI.library.scope('DynAPI.api.*', this);
alert(DynLayer);

There's lots and lots of fun to be had with this library loader as long as you can get 
used to the dependency list requirement.

(brainstroming...) There actually there probably will be a way to get files to load 
their required scripts without using a dependency list.  I by default call the 
function called "main()" if it's available in the script, it is called when the script 
is finished loading.  Inside that script you could then call 
DynAPI.library.load('DependentObj', construct), and in the construct() object create 
your object.

Dan Steinman


On Thu, Jan 03, 2002 at 11:20:53PM +1100, Michael Pemberton wrote:
> With all the talk of internal redesign and the like, I figure now is a 
> good time to try get some of my changes implemented.
> 
> I saw on the website that someone posted a suggested method for stopping 
> text selection when clicking.  I propose that we implement my current 
> code for stopping text selection and rightmouse menus.
> 
> I see very little reason for not including it.  I just need someone to 
> get it to work with the current mouse event structure.  With a few lines 
> of code, it is possible to stop text selection / right mouse menus in 
> almost any browser.  I anyone has any reasons for not implementing it, 
> I'd be interested to hear them.  Also, if anyone out there is willing to 
> give the conversion a go, I'd also be interested to hear from them.
> 
> Also, Dan, can you explain to me why you are using async loading?  Won't 
> this cause problems with some of the code downloading out of order and 
> cause problems with making sure that something has finished loading 
> before using it?  You will find that at the top of the widget files as 
> part of my A***API, that the widgets are able to define their required 
> files and load any missing components, I fail to see how this would be 
> done in an async setup without a confusing web of intermediate methods 
> at each load point.
> 
> -- 
> Michael Pemberton
> [EMAIL PROTECTED]
> ICQ: 12107010
> 
> 
> 
> 
> 
> _______________________________________________
> Dynapi-Dev mailing list
> [EMAIL PROTECTED]
> http://www.mail-archive.com/dynapi-dev@lists.sourceforge.net/

_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/dynapi-dev@lists.sourceforge.net/

Reply via email to