:: Forum >> Version 1 >>

Input template doesn't work with onMouseOver event...

Hi there folks,

i've struggled for days until guess that my grid's onmouseover event was "blocking" the input template. I didn't find any reason for this, maybe the order which dblclick and mouseover events are called... i don't get it for now. I think this two characteristics (onmouseover and input template) should be integrated easily but to me it seems they arent... for sure is something missing me.
Does anyone see the problem here?!
Thanks a bunch!

The input template code:

My.Templates.Input Active.Templates.Text.subclass();
        
        
My.Templates.Input.create = function()
        {
            var 
obj this.prototype;
    
            var 
editor = new Active.HTML.INPUT;
            
editor.setClass("templates""input");
            
editor.setAttribute("type""text");
            
editor.setAttribute("value", function(){
            return 
template.getItemProperty("text");
            });
            
            var 
template;
        
            function 
switchToEditMode(){
                if (
template) {
                    
switchToTextMode()
                }
                
template this;
                 
//template.element().style.padding = 0; 
                
template.element().className += " active-edit-mode ";
                
template.element().innerHTML editor;
                
editor.element().focus();
                
editor.setEvent("ondblclick"editor.element().focus()); 
            } 
        
            
obj.setEvent("ondblclick"switchToEditMode);
        
            function 
switchToTextMode(){
                var 
value editor.element().value;
                
template.setItemProperty("text"value);
                
template.refresh();
                
template null;
            }
            
editor.setEvent("onblur"switchToTextMode);
        }
        
        
My.Templates.Input.create(); 
  
The script code:
var obj = new Active.Controls.Grid;
    
    var 
template = new My.Templates.Input;
    
    
obj.setColumnTemplate(template);
    
obj.setRowProperty("count"9);
    
obj.setColumnProperty("count"5);
    
    
obj.setDataProperty("text", function(ij){return myData[i][j]});
    
obj.setColumnProperty("text", function(i){return myColumns[i]});

    
obj.getDataText = function(ij){return myData[i][j]};
    
obj.setDataText = function(valueij){myData[i][j] = value};

    var 
row = new Active.Templates.Row;
    
row.setEvent("onmouseover""mouseover(this, 'active-row-highlight')");
    
row.setEvent("onmouseout""mouseout(this, 'active-row-highlight')");
    
obj.setRowTemplate(row);

    
obj.setEvent("onkeydown"null);        
    
obj.getTemplate("top").setEvent("onselectstart"obj.getEvent("onselectstart"));
    
obj.setEvent("onselectstart"null);
    
    
document.write(obj);
 
Ricardo Guerra
Tuesday, August 9, 2005
Sure, it is possible
The place you must put this events is.... inside the template,
Try to put this lines at the end of the input template
right before the lines:

}
My.Templates.Input.create();

function isover(){window.status "AAAAA"}
function 
isout(){window.status ""}
 
editor.setEvent("onmouseover"isover );
 
editor.setEvent("onmouseout"isout );
 
Reference other parts of the grid inside the template (temporary code) is not as easy as normal functions, so I recomend you reading other templates to learn "how they work" before try to do it more complex.
HTH
Thanks
Carlos
Tuesday, August 9, 2005
Uppsss! , Sorry I missunterstud the main question
(Maybe I am geting old) -- ;-)

Your code is right, it's nothing more than a code order issue.

Just move the line:
obj.setColumnTemplate(template);
and put it after:
obj.setRowTemplate(row);

I always place column-templates at the bottom, so i never notice this could be happen (today I learned one more !) so ... Ricardo , thanks for your "mistake".
Saludos,



Carlos
Wednesday, August 10, 2005
Hola Carlos!

Thanks for replying! You're definitely right!!!
I was reviewing stuff like that as you later advised me...

So, there is nothing with your age, old man :)

Muchas Gracias
Ricardo Guerra
Wednesday, August 10, 2005



This topic is archived.

Back to support forum

Forum search