Hi,

I sent a reply to this yesterday, but it bounced
because I attached the Javascipt file. This time I've
pasted it in...

>Can you give an example of your custom method. 
>If you place a check
>for "this.created==true", it should stop it from
>executing during the initial
>creation stage.

I'm defining setHTML as a prototype in my widget
definition. I'm not sure how I can do a
this.created==true test on a prototype definition.

I thought perhaps I shouldn't be overriding setHTML,
but I was looking at IllMaestro's widget's yesterday,
and his window widget also overrides setHTML. I'd be
interested to hear if anyone has tried these widgets
with the latest API.

Anyway, here's some example code so you can see the
problem:

mywidget.js
-----------------------
function MyWidget(name,x,y,w,h,color) {
        x = x || 0;
        y = y || 0;
        w = w || 300;
        h = h || 200;
        color = color || '#ffffff';

        this.DynLayer = DynLayer
        this.DynLayer(null,x,y,w,h,color);

        this.canvas = new
DynLayer(null,10,10,this.getWidth()-20,this.getHeight()-20,'#c0c0c0');
        this.addChild(this.canvas);
        return this;
};
MyWidget.prototype=new DynLayer();
MyWidget.prototype.setHTML=function(html,noevt) {
        this.canvas.setHTML(html,noevt);
};
MyWidget.prototype.getHTML=function(html,noevt) {
        return this.canvas.getHTML();
};
------------------

mywidget.html
------------------
<html>
<head>
<script language="Javascript"
src="../src/dynapi.js"></script>
<script language="Javascript">
DynAPI.setLibraryPath('../src/lib/');
DynAPI.include('dynapi.api.*');
</script>
<script language="Javascript"
src="mywidget.js"></script>
<script language="Javascript">

DynAPI.onLoad = function() {
        myLayer = new MyWidget()
        myLayer.setBgColor('#000000')
        myLayer.moveTo(100,100)
        myLayer.setHTML('this is the canvas')
        DynAPI.document.addChild(myLayer)
}

</script>
</head>
<body bgcolor="#ffffff">
</body>
</html>
---------------

__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/dynapi-dev

Reply via email to