:: Forum >>

Object doesn't support this property or method




The following works as expected:

var lbl = new SDI.ECS.Label();
lbl.setText("Hello");
document.write(lbl);



But this causes an error


var div = new Active.HTML.DIV;
var lbl = new SDI.ECS.Label();
lbl.setText("Hello");
div.setContent( "lbl", lbl );
document.write( div );



n html.js during evaluation of
this["{#0}"]();
I recieved the error in the title.



The superclass code that extends Active.System.HTML is

SDI.ECS.Component = Active.System.HTML.subclass();

/**
* Base Object for the ECS Component Heirarchy
*/

SDI.ECS.Component.create = function(){

    var obj = this.prototype;
    var _super = this.superclass.prototype;

    obj.setClass("sdi", "component");

    obj.join = function(){
        var i, s = arguments[0];
        for (i=1; i<arguments.length; i++){s += arguments[i].substr(0,1).toUpperCase() + arguments[i].substr(1)}
        return s;
    };

    obj.refs = SDI.ECS.Component.refs = [];

obj.defineProperty = function( name, defaultVal ) {
var property = "__"+name;
var getter = this.join( "get", name );
var setter = this.join( "set", name );
this[property] = defaultVal;
this[getter] = function() {
return typeof(this[property])=="function" ?
this[property].call(this) :
this[property];
}
this[setter] = function( val ) { this[property] = val; }
}


obj.defineProperty( "name", function(){return "ECSComponent_"+this.getId();} );
obj.defineProperty( "refId", function(){return this.getId();} );
obj.defineProperty( "document", null );
obj.defineProperty( "referenceNode", null );
obj.defineProperty( "xpath", null );

obj.defineProperty( "tooltip", null );
obj.setAttribute("title", function(){ return this.getTooltip(); });

obj.defineProperty( "debug", false );

obj.debug = function( msg ) {
if (this.getDebug()) {
alert( msg );
}
}

};

SDI.ECS.Component.create();


And the Label code in my problem is

SDI.ECS.Label = SDI.ECS.Component.subclass();

/**
*
*/

SDI.ECS.Label.create = function(){

    var obj = this.prototype;
    obj.setTag("span");
    obj.setClass("ecs", "Label");

obj.defineProperty( "text", "Label" );

obj.setContent( "labelText", function(){
return this.getText();
} );

};

SDI.ECS.Label.create();


In the debugger, the line

obj.setContent( "labelText", function(){
return this.getText();
} );


Gets a complaint that this.getText is not a property or method.
Any Idea why???
gbegley
Wednesday, July 7, 2004
The following worked, but I still have no Idea why!

var div = new Active.HTML.DIV;
var lbl = new SDI.ECS.Label();
lbl.setText("Hello");
div.setContent( "lbl", function( ) { return lbl;} );

document.write( div );
gbegley
Wednesday, July 7, 2004

This topic is archived.


Back to support forum

Forum search