--- Benoit Marchant <[EMAIL PROTECTED]> wrote:
> I've been playing with <div> in Netscape 4 so that I
> can use some 
> static html accross many browsers, as in dynapi 1,
> that's what was used 
> even for NS4. The key to have stuff working in NS4
> is to use #div_id or 
> .ClassName in a <style> </style> in the page or
> linked through a css 
> file. Any <div style=""> is fatal to NS4 !

In NS4 I was planning on using <layers>

I'll also take a look at using <style> sheets/classes
  
> So tell me if I'm wrong, but your TemplateDesigner
> is not meant to 
> change the properties of all the generated layers
> that used it, right ? 

Correct. It's only used to create precreated-templated
that are used before the layer is created.

> So if that's true, then the class could be used.
> 
> Now if we wanted to do that, then a Template object
> (so a real object 
> compared to the current dictionary) could keep track
> of all the 
> dynlayers that use it.
> So at creation, the template output a .className,
> and all dynlayers's 
> divs refers to that class.
> At modification, if you want to change one dynlayer,
> use regular apis.
> If you want to change all layers using the same
> template, then call a 
> method on the template, and the template will
> iterate on all the layers 
> and individually change the same property to the
> same value.
> 
> Call it a DynClass, or DynCSSClass and we got a very
> nice stuff !!! 
> What do you think ?

Great idea! Sound good.

 
> I was wondering if we could just javascript tricks
> like function.call
> 
> 
> function product(name, value){
>     this.name = name;
>     if(value > 1000)
>        this.value = 999;
>     else
>        this.value = value;
> }
> 
> function prod_dept(name, value, dept){
>     this.dept = dept;
>     product.call(this, name, value);
> }
> 
> prod_dept.prototype = new product();
> 
> // since 5 is less than 100 value is set
> cheese = new prod_dept("feta", 5, "food");
> 
> // since 5000 is above 1000, value will be 999
> 
>In dynapi, we don't use call, and I don't understand
>why ?

We use the following:

function MyWiget(whatever,html,x,y,w,h,color){
   this.DynLayer = DynLayer;
   this.DynLayer(html,x,y,w,h,color)
}
MyWiget.prototype = new DynLayer;

IMO it does the same as the .call method.

>Nonetheless, ideally you should be able to do
>
>MyWidget inherit from DynLayer
>function MyWidget(html,x,y,w,h,color,top, Bottom)
{...}
>and
>myNewWidget = MyWidget.getInline(p,id,
>html,x,y,w,h,color,top, Bottom);
>
>DynLayer.getInline = function(p,id,
>html,x,y,w,h,color,top, Bottom)
>
>       //instead of    var dlyr = new DynLayer();
>       //something like dlyr = new (can you get >MyWidget
dynamically there ? 
>calling prototype or something?)(arguments minus p
>and id)
>}

I see what you're trying to do. You're trying to
construct a widget from an inline div, correct? So you
would like the option to be able to pass paraments to
the widget from an the getInline() function? What I
think you're forgetting is the section of getInline()
that calls DynLayer._updateValues(). The
DynLayer._updateValues() function will overwrite your
x,y,w,h,bgcolor,bgimage and html properties that you
would have set from the widget/layer.

Secondly if you were to construct a widget from an
inline layer then you will have to remeber that the
widget's parent will become that of the inline layer.
This could really mess up parant/child relationship if
it's not used properly.

In any event I would suggest that you try doing
something like this:

DynLayer.getInline = function (id, p,
a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14) {
        var elm;
        var pobj;
        if (!p) pobj = dynapi.document;
        else if (p.isClass && p.isClass('DynElement')) pobj =
p;
        
        if (pobj) {
                if (dynapi.ua.ns4) elm = pobj.doc.layers[id];
                else if (dynapi.ua.ns6) elm =
pobj.doc.getElementsByID(id);
                else if (dynapi.ua.ie) elm = pobj.doc.all[id];
        }
        if (!elm) return alert("DynLayer_inline Error: did
not find element "+id);

        var className=this.prototype._className; //get class
name
        
        var dlyr = eval('new
'+className+'(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14)');
        
        dlyr.setID(id);
        dlyr.parent = pobj;
        dlyr.elm = elm;
        if (dynapi.ua.ns4) dlyr.doc = elm.document;
        DynLayer._updateValues(dlyr);
        DynLayer._assignElement(dlyr,elm);
        DynElement._flagEvent(dlyr,'create');
        return dlyr;
}

function MyWidget(a,b,c){
   // code here;
}

MyWidget.getInline=DynLayer.getInline;



Best regards,

--
Raymond Irving



That should work as long as each constructor of each
subclass respect 
and re declare the arguments of it's super class.
Otherwise it gets 
harder to know what to pass, or we could do this:

DynLayer.getInline = function(p,id, className,
constructorArguments) {

        eval("var dlyr = new "+ className+"("+
constructorArguments+")");
}
If there's a way to get classname with javascript
language features, 
that would be even better.




__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[EMAIL PROTECTED]/

Reply via email to