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();
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(i, j){return myData[i][j]});
obj.setColumnProperty("text", function(i){return myColumns[i]});
obj.getDataText = function(i, j){return myData[i][j]};
obj.setDataText = function(value, i, j){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);
function isover(){window.status = "AAAAA"}
function isout(){window.status = ""}
editor.setEvent("onmouseover", isover );
editor.setEvent("onmouseout", isout );
This topic is archived.