:: Forum >> Version 2 >>

How to set properities for all new Inputs ?

Hi, another dumb question...

I've tryed this:

AW.UI.INPUT.onControlActivated = function(event){
   
this.setStyle('background''#CFDEFF'); 
}
        
AW.UI.INPUT.onControlDeactivated = function(event){  
   
this.setStyle('background''white');

 
but it seems to not work. I just do not want to make it for each and every input itself...

What am I doing wrong ?
ASJ
Sunday, April 23, 2006
You are adding methods to the constructor function. Instead you should modify the object prototype -

AW.UI.Input.prototype.onControlActivated = function(event){
   
this.setStyle('background''#CFDEFF');
}

AW.UI.Input.prototype.onControlDeactivated = function(event){
   
this.setStyle('background''white');
}

var 
obj = new AW.UI.Input;
document.write(obj);

 
Even better would be adding your subclass -

var MyInput AW.UI.Input.subclass();

MyInput.create = function(){

    var 
obj this.prototype;

    
obj.onControlActivated = function(event){
       
this.setStyle('background''#CFDEFF');
    }

    
obj.onControlDeactivated = function(event){
       
this.setStyle('background''white');
    }
}

var 
obj = new MyInput;
document.write(obj);

 
Alex (ActiveWidgets)
Monday, April 24, 2006



This topic is archived.

Back to support forum

Forum search