<?xml version="1.0" encoding="UTF-8"?>
<rmml>
<!--
$RCSfile: rnmc_stdInput.xml $
$Revision: 938 $

last change: $Date: 2009-02-06 13:34:59 +0300 (Пт, 06 фев 2009) $
             $Author: toha $

  Lacerta Project
  version 1.0.0.1
  Copyright (C) 2008 RNMC
-->
<!--
====================================================================================================================
      Визуальный объект 'Ввод текста'
====================================================================================================================
-->
<composition name="rnmc_stdInputEx" class="rnmc_stdMediaObject">
<sequencer name="updateSequencer" playing="true" loop="true">
<script>
  updateTimer();
</script>
</sequencer>
<script event="onMouseDown">
  this.onLMouseDown();
</script>
<script><![CDATA[
  this.type = "rnmc_stdInputEx"
  
  //  действия при нажатии клавиши на клавиатуре
  this.onKeyDownActions = null;
  //  действия при отжатии клавиши на клавиатуре
  this.onKeyUpActions = null;        
//  действия на правильно введённое слово
  this.onInputBoxCompleteActions = null;
//  действия на неправильно введённое слово
  this.onInputBoxWrongActions = null;
  
  // Рамка вокруг поля ввода;
  this.cellBorderObject = null;
  
  // Текущее положение курсора
  this.currPosCursor = 0;
  
  // Параметры таймера
  this.timerParam = new Object();
  this.timerParam.playStart = 0;
  this.timerParam.lastTimerValue = 0;
  this.timerParam.timeOut = 600;
  
  // Курсор, моргающий
  this.imgCursor = null;
  this.imgCursorSrc = "";
  
  // Максимальное количество символов в поле
  // -1 - безконечность
  this.maxChars = 32000;
  
  // Параметры бордюра
  this.brdClrNormal  = "#000000";
  this.brdClrActive  = "#000000";
  this.brdClrError   = "#000000";
  this.brdSizeNormal = 0;
  this.brdSizeActive = 0;
  this.brdSizeError  = 0;
  
  // Параметры текстового поля
  this.txtStyleNormal  = null;
  this.txtStyleActive  = null;
  this.txtStyleDisable = null;
  this.txtStyleError   = null;
  
  // Тут хранится строка, которую следует проверить
  // с введеным текстом
  this.checkText = "";
  
  this.disableInput = false;
  
  // Если этот флаг выставлен, значит данное поле прошло проверку
  // и результат в нем верный
  this.check_res_is_true = false;
  
  // Если true, то данное поле будет проверятсо на определенное значение
  this.is_test_this = false;
  
  // Поле ввода находится в состоянии только для чтения
  this.isReadOnly = false;
  
  // Последнее состояние ячейки после проверки
  // 0 - проверка не проводилась
  // 1 - результат "успешно"
  // 2 - результат "ошибка"
  this.lastStateCheck = 0;
  
  // используем в проверке регулярные выражения или нет
  this.regex = false;
  
  function initFromNode(srcNode){
    var xmlNode = null;
    var xmlAttributeMap = null;
    var xmlAttribute = null;

    xmlAttributeMap = srcNode.attributes;
    if (xmlAttributeMap){
      xmlAttribute = xmlAttributeMap.getNamedItem("id");
      if (xmlAttribute != null && xmlAttribute.specified)
        this.id = xmlAttribute.value;
      xmlAttribute = xmlAttributeMap.getNamedItem("visible");
      if (xmlAttribute != null && xmlAttribute.specified){
        if(xmlAttribute.value.toLowerCase() == "true")
          this.visibility = OBJECT_VISIBILITY_TRUE;
        else if(xmlAttribute.value.toLowerCase() == "false")
          this.visibility = OBJECT_VISIBILITY_FALSE;
      }
      xmlAttribute = xmlAttributeMap.getNamedItem("enabled");
      if (xmlAttribute != null && xmlAttribute.specified && 
          xmlAttribute.value.toLowerCase() == "false")
        this.disabled = true;
    }    

    xmlNode = srcNode.firstChild;
    while(xmlNode){
      if(xmlNode.nodeName.toLowerCase() == "param"){
        this.parseParamNode(xmlNode);
        xmlAttributeMap = xmlNode.attributes;
        if (xmlAttributeMap){
          xmlAttribute = xmlAttributeMap.getNamedItem("maxChars");
          if (xmlAttribute != null && xmlAttribute.specified)
            this.maxChars = parseInt(xmlAttribute.value);
          xmlAttribute = xmlAttributeMap.getNamedItem("check_text");
          if (xmlAttribute != null && xmlAttribute.specified){
            this.is_test_this = true;
            this.checkText = xmlAttribute.value;
          }
          xmlAttribute = xmlAttributeMap.getNamedItem("regex");
          if (xmlAttribute != null && xmlAttribute.specified){
            switch (xmlAttribute.value.toLowerCase()){
              case "true":
                this.regex = true;
                break;
              case "false":
                this.regex = false;
                break;
            }
          }
        }
        
        var xmlNodeTmp = xmlNode.firstChild;
        while (xmlNodeTmp){
          if(xmlNodeTmp.nodeName.toLowerCase() == "styles"){
            xmlAttributeMap = xmlNodeTmp.attributes;
            if (xmlAttributeMap){
              xmlAttribute = xmlAttributeMap.getNamedItem("styleNormal");
              if (xmlAttribute != null && xmlAttribute.specified)
                this.txtStyleNormal = xmlAttribute.value;
              xmlAttribute = xmlAttributeMap.getNamedItem("styleActive");
              if (xmlAttribute != null && xmlAttribute.specified)
                this.txtStyleActive = xmlAttribute.value;
              xmlAttribute = xmlAttributeMap.getNamedItem("styleDisable");
              if (xmlAttribute != null && xmlAttribute.specified)
                this.txtStyleDisable = parseInt(xmlAttribute.value);
              xmlAttribute = xmlAttributeMap.getNamedItem("styleError");
              if (xmlAttribute != null && xmlAttribute.specified)
                this.txtStyleError = parseInt(xmlAttribute.value);
            }
          } else if(xmlNodeTmp.nodeName.toLowerCase() == "border"){
            xmlAttributeMap = xmlNodeTmp.attributes;
            if (xmlAttributeMap){
              xmlAttribute = xmlAttributeMap.getNamedItem("clrNormal");
              if (xmlAttribute != null && xmlAttribute.specified)
                this.brdClrNormal = xmlAttribute.value;
              xmlAttribute = xmlAttributeMap.getNamedItem("clrActive");
              if (xmlAttribute != null && xmlAttribute.specified)
                this.brdClrActive = xmlAttribute.value;
              xmlAttribute = xmlAttributeMap.getNamedItem("clrError");
              if (xmlAttribute != null && xmlAttribute.specified)
                this.brdClrError = xmlAttribute.value;
              xmlAttribute = xmlAttributeMap.getNamedItem("sizeNormal");
              if (xmlAttribute != null && xmlAttribute.specified)
                this.brdSizeNormal = parseInt(xmlAttribute.value);
              xmlAttribute = xmlAttributeMap.getNamedItem("sizeActive");
              if (xmlAttribute != null && xmlAttribute.specified)
                this.brdSizeActive = parseInt(xmlAttribute.value);
              xmlAttribute = xmlAttributeMap.getNamedItem("sizeError");
              if (xmlAttribute != null && xmlAttribute.specified)
                this.brdSizeError = parseInt(xmlAttribute.value);
            }
          } else if(xmlNodeTmp.nodeName.toLowerCase() == "caretka"){
            xmlAttributeMap = xmlNodeTmp.attributes;
            if (xmlAttributeMap){
              xmlAttribute = xmlAttributeMap.getNamedItem("src");
              if (xmlAttribute != null && xmlAttribute.specified){
                this.imgCursorSrc = "..\\" + xmlAttribute.value;
              }
            }
          }
          xmlNodeTmp = xmlNodeTmp.nextSibling;
        }
      } else if(xmlNode.nodeName.toLowerCase() == "value"){
        if(xmlNode.textContent)
          this.objectValue = xmlNode.textContent;
      } else if(xmlNode.nodeName.toLowerCase() == "actions"){
        //  стандартые события
        rnmc_stdMediaObject_parseActionsNode(xmlNode);
        //  разбор действий при нажатии клавиши на клавиатуре
        this.onKeyDownActions = scene.Utils.parseActionsNode(xmlNode, "onKeyDown");
        //  разбор действий при отпускании клавиши на клавиатуре
        this.onKeyUpActions = scene.Utils.parseActionsNode(xmlNode, "onKeyUp");        
        //  действия на правильно введённое слово
        this.onInputBoxCompleteActions = scene.Utils.parseActionsNode(xmlNode, "onInputBoxComplete");
        //  действия на неправильно введённое слово
        this.onInputBoxWrongActions = scene.Utils.parseActionsNode(xmlNode, "onInputBoxWrong");
      } else if(xmlNode.nodeName.toLowerCase() == "hint"){
        this.parseHintNode(xmlNode);
      }
      xmlNode = xmlNode.nextSibling;
    }
    return true;
  };

  function loadObject(){
    if(!this.objectContent){
      this.objectContent = new Text();
      this.objectContent.parent = this;
      this.objectContent.onSetFocus  = this.onSetFocusHandlerAlias;
      this.objectContent.onKillFocus = this.onKillFocusHandlerAlias;      
    }
  }

  function unloadObject(){
    this.effectsTarget = null;
    if(this.objectContent){
      this.objectContent.visible = false;
      this.objectContent.parent = null;
      this.objectContent = null;
    }
  }

  function showObject(){
    this.x = 0;
    this.y = 0;
    
    this.loadObject();
    
    if(this.objectContent){
      if(this.objectStyle)
        this.objectContent.style = this.objectStyle;  
        
      this.setPosition(this.objectX, this.objectY, this.objectWidth, this.objectHeight, this.objectDepth);
      this.objectContent.opacity  = this.objectOpacity;
      
      if (this.txtStyleNormal)
        this.objectContent.style = this.txtStyleNormal;
        
      this.objectContent.bkgColor = "#FFFFFF";
      if(this.objectBgColor)
        this.objectContent.bkgColor = this.objectBgColor;

      //if(this.onKeyDownActions){
        this.objectContent.onKeyDown = this.onKeyDownHandlerAlias;
      //}
      //if(this.onKeyUpActions){
        this.objectContent.onKeyUp = this.onKeyUpHandlerAlias;
      //}
    }
    this.objectContent.visible = true;
    
    if(!this.cellBorderObject){
      this.cellBorderObject = new Text();
      this.cellBorderObject.bkgColor = this.brdClrNormal;
      this.cellBorderObject.adjustHeight = false;
      this.cellBorderObject.x = this.objectX - this.brdSizeNormal;
      this.cellBorderObject.y = this.objectY - this.brdSizeNormal;
      this.cellBorderObject.width = this.objectWidth + 2*this.brdSizeNormal;
      this.cellBorderObject.height = this.objectHeight + 2*this.brdSizeNormal;
      this.cellBorderObject.depth = this.objectContent.depth+1;
      this.cellBorderObject.visible = this.objectContent.visible;
      this.cellBorderObject.parent = this;
    }
    
    if (!this.imgCursor != null && this.imgCursorSrc != ""){
      this.imgCursor = new Image();
      this.imgCursor.src = this.imgCursorSrc;
      this.imgCursor.visible = false;
      this.imgCursor.x = this.objectX;
      this.imgCursor.y = this.objectY;
      this.imgCursor.height = this.objectHeight;
      this.imgCursor.depth = this.objectDepth-1;
      this.imgCursor.enable = false;
      this.imgCursor.parent = this;
    }
    
    if (this.objectValue){
      this.objectContent.value = this.objectValue;
      if (this.objectContent.value.length > 0){
        var mediaSize = this.objectContent.getMediaSize();
        this.currPosCursor = this.objectContent.value.length;
        
        if (this.imgCursor != null){
          this.imgCursor.x += mediaSize.width;
        }
      }
    }
    
  //  перебор присоединённых эффектов для показа
    this.effectsTarget = this.objectContent;
    var showEffectsCount = this.startEffects(EVENT_ON_SHOW);
    if(showEffectsCount == 0){
      this.objectContent.visible = true;
    }
    
    updateCursorPos();

    rnmc_stdMediaObject_showObject();

    if (this.objectSetFocus)
      setFocus(this.objectContent);
  }

  //  Получение значений параметров объектов из user-mode
  function getObjectProperty(objectId, propertyName){
    if(objectId != this.id)
      return null;
    switch(propertyName){
    case "value":
      return this.objectContent.value;
      break;
    default:
      return null;      
    }  
  }
  
  function hideObject(){
    rnmc_stdMediaObject_hideObject();
  };
  
  function onKeyDownHandlerAlias(){
    onKeyDownHandler();
  }

  function onKeyDownHandler(){
    if (this.isReadOnly)
      return;
      
    if (this.disableInput){
      return;
    }
    
    switch(Key.keyCode){
    case 8:     //  BACKSPACE
      if (this.objectContent.value.length > 0 && this.currPosCursor > 0)
      {
        var new_str = this.objectContent.value.slice(0, this.currPosCursor-1);
        
        if (this.currPosCursor < this.objectContent.value.length)
          new_str += this.objectContent.value.slice(this.currPosCursor, this.objectContent.value.length);
          
        this.objectContent.value = new_str;
        --this.currPosCursor;
        
        updateCursorPos();
      }
      break;
    case 46:    //  DELETE
      if (this.currPosCursor < this.objectContent.value.length)
      {
        var new_str = this.objectContent.value.slice(0, this.currPosCursor);
        new_str += this.objectContent.value.slice(this.currPosCursor+1, this.objectContent.value.length);
        this.objectContent.value = new_str;
        
        if (this.objectContent.value.length==0){
          updateCursorPos();
        }
      }
      break;
    case 13:    //  ENTER
      break;
    case 32:    //  SPACE (LONG KEY)
      this.objectContent.value += "  ";
      ++this.currPosCursor;
      updateCursorPos();
      break;
    case 35:    // END
      if (this.currPosCursor < this.objectContent.value.length){
        this.currPosCursor = this.objectContent.value.length;
        updateCursorPos();
      }
      break;
    case 36:    // HOME
      if (this.currPosCursor > 0){
        this.currPosCursor = 0;
        updateCursorPos();
      }
      break;
    case 37:    //  LEFT ARROW
      if (this.currPosCursor > 0){
        --this.currPosCursor;
        updateCursorPos();
      }
      break;
    case 38:    //  UP ARROW
      break;
    case 39:    //  RIGHT ARROW
      if (this.currPosCursor < this.objectContent.value.length){
        ++this.currPosCursor;
        updateCursorPos();
      }
      break;
    case 40:    //  DOWN ARROW
      break;
    default:
      if (!this.objectContent.value || maxChars > this.objectContent.value.length){
        var curChar = "";
        var unicode_key = Key.getUnicode();
        
        if (unicode_key <= 0)
          break;
          
        curChar = unescape(scene.Utils.sprintf("%%u%04X",unicode_key));
        
        var new_str = "";
        
        if (!this.objectContent.value){
          new_str = curChar;
        }
        else{
          var new_str = this.objectContent.value.slice(0, this.currPosCursor);
          new_str += curChar;
          new_str += this.objectContent.value.slice(this.currPosCursor, this.objectContent.value.length);
        }
        
        var original_str = this.objectContent.value;
        this.objectContent.value = new_str;
        var mediaSize = this.objectContent.getMediaSize();
        
        if (mediaSize.width < this.objectContent.width){
          ++this.currPosCursor;
          updateCursorPos();
        }else{
          this.objectContent.value = original_str;
        }
      }
    }
  }
  
  function onKeyUpHandlerAlias(){
    onKeyUpHandler();
  }

  function onKeyUpHandler(){
  }
  
  function buttonDispatcher(btnId){
    switch(btnId){
    default:
      rnmc_stdMediaObject_buttonDispatcher(btnId);
    }
  }
  
  function updateTimer(){
    if (this.imgCursor != null && this.imgCursor.enable){
      if (this.timerParam.lastTimerValue == 0)
        this.timerParam.lastTimerValue = Player._time;
        
      if (Player._time - this.timerParam.lastTimerValue > this.timerParam.timeOut){
        this.timerParam.lastTimerValue = Player._time;
        
        if (this.imgCursor)
          this.imgCursor.visible = !this.imgCursor.visible;
      }
    }
  }
  
  function updateCursorPos(){
    if (this.objectContent.value && this.objectContent.value.length > 0){
      var tmp_str = this.objectContent.value;
      var new_str = this.objectContent.value.slice(0, this.currPosCursor);
      
      this.objectContent.value = new_str;
      var mediaSize = this.objectContent.getMediaSize();
      
      if (this.imgCursor != null){
        this.imgCursor.x = this.objectContent.x + mediaSize.width;
      }
      
      this.objectContent.value = tmp_str;
    }else if (this.imgCursor != null){
      this.imgCursor.x = this.objectContent.x + 3;
    }
  }
  
  function onLMouseDown(){
    if (this.isReadOnly)
      return;
      
    if (this.disableInput){
      return;
    }
    
    var the_pt = parent.globalToLocal(Mouse.x-this.objectX, Mouse.y-this.objectY);
    var the_pt2 = parent.globalToLocal(Mouse.x, Mouse.y);
/*    
    trace("#AA1157objectX = " + this.objectContent.x + "; objectY = " + this.objectContent.y);
    trace("#CC2267Mouse.x = " + Mouse.x + "; Mouse.y = " + Mouse.y);
    trace("#DD3367the_pt.x = " + (Mouse.x-scene.x) + "; the_pt.y = " + (Mouse.y-scene.y));
*/    
    if (!this.objectContent.isPointIn((Mouse.x-scene.x), (Mouse.y-scene.y))){
      return;
    }

    var original_str = this.objectContent.value;
    this.objectContent.value = "";
    var index1 = 0;
    var index2 = -1;
    
    if (original_str && original_str.length > 0){
      for (i = 0; i < original_str.length; ++i){
        this.objectContent.value += original_str[i];
        var mediaSize = this.objectContent.getMediaSize();
        
        if (the_pt.x > mediaSize.width){
          index1 = i+1;
        }
        if (the_pt.x <= mediaSize.width){
          index2 = i+1;
        }
        
        if (index2 > -1){
          this.currPosCursor = index1;
          updateCursorPos();
          break;
        }else{
          this.currPosCursor = original_str.length;
          updateCursorPos();
        }
      }
      
      this.objectContent.value = original_str;
    }
  }
  
  function OnSetFocus(){
    if (this.isReadOnly)
      return;
      
    if (this.disableInput){
      return;
    }
      
    if (this.imgCursor != null){
      this.imgCursor.enable = true;
    }
    
    if (this.lastStateCheck == 2)
      return;
      
    if(this.objectBgColorActive){
      this.objectContent.bkgColor = this.objectBgColorActive;
    }
      
    if (this.txtStyleActive){
      this.objectContent.style = this.txtStyleActive;
    }
      
    if (this.cellBorderObject){
      this.cellBorderObject.bkgColor = this.brdClrActive;
      this.cellBorderObject.x = this.objectX - this.brdSizeActive;
      this.cellBorderObject.y = this.objectY - this.brdSizeActive;
      this.cellBorderObject.width = this.objectWidth + 2*this.brdSizeActive;
      this.cellBorderObject.height = this.objectHeight + 2*this.brdSizeActive;
    }
  }
  
  function OnKillFocus(){
    if (this.isReadOnly)
      return;
      
    if (this.disableInput)
      return;
    
    if (this.imgCursor != null){
      this.imgCursor.enable  = false;
      this.imgCursor.visible = false;
    }
    
    if (this.lastStateCheck == 2)
      return;

    if(this.objectBgColor){
      this.objectContent.bkgColor = this.objectBgColor;
    }
      
    if (this.txtStyleNormal){
      this.objectContent.style = this.txtStyleNormal;
    }
      
    if (this.cellBorderObject){
      this.cellBorderObject.bkgColor = this.brdClrNormal;
      this.cellBorderObject.x = this.objectX - this.brdSizeNormal;
      this.cellBorderObject.y = this.objectY - this.brdSizeNormal;
      this.cellBorderObject.width = this.objectWidth + 2*this.brdSizeNormal;
      this.cellBorderObject.height = this.objectHeight + 2*this.brdSizeNormal;
    }
  }
  
  function checkObject(){
    this.lastStateCheck = 1;
    
    if (this.checkText){
      if (this.checkText == ""){
        if (this.objectContent && this.objectContent.value == ""){
          disableObject();
          
          this.check_res_is_true = true;
          
          if(this.onInputBoxCompleteActions)
            this.timer_id = setTimeout("this.doCompleteActions()", 10);
        } else {
          this.setError();
          
          if(this.onInputBoxWrongActions){
            this.timer_id = setTimeout("this.doWrongActions()", 10);
          }
        }
      } else {
        if (this.regex){
          var pat = this.checkText.match(/\/.*\//i);
          
          if (pat != null){
            pat = pat[0].slice(1,(pat[0].length-1));
          }

          var swtc = this.checkText.match(/[a-zA-Z0-9]$/i);
          
          if (swtc != null){
            swtc = swtc[0];
          }
          
          var re = 0;
          
          if (pat != null)
            re = new RegExp(pat, swtc == null ? "" : swtc);
          
          if (this.objectContent.value && re != 0 &&
              this.objectContent.value.search(re) != -1){
            disableObject();
            
            this.check_res_is_true = true;

            if(this.onInputBoxCompleteActions)
              this.timer_id = setTimeout("this.doCompleteActions()", 10);
          } else {
            this.setError();
            
            if(this.onInputBoxWrongActions){
              this.timer_id = setTimeout("this.doWrongActions()", 10);
            }
          }
        }else{
          if (this.objectContent.value && 
              this.checkText.toLowerCase() == this.objectContent.value.toLowerCase()){
            disableObject();
            
            this.check_res_is_true = true;

            if(this.onInputBoxCompleteActions)
              this.timer_id = setTimeout("this.doCompleteActions()", 10);
          } else {
            this.setError();
            
            if(this.onInputBoxWrongActions){
              this.timer_id = setTimeout("this.doWrongActions()", 10);
            }
          }
        }
      }
    }
  }
  
  function resetObject(){
    this.disableInput = false;
    this.imgCursor.enable = false;
    this.imgCursor.visible = false;
    this.lastStateCheck = 0;
    
    this.objectContent.value = "";
    
    if (this.objectBgColor)
      this.objectContent.bkgColor = this.objectBgColor;
      
    if (this.txtStyleNormal)
      this.objectContent.style = this.txtStyleNormal;
      
    if (this.cellBorderObject){
      this.cellBorderObject.bkgColor = this.brdClrNormal;
      this.cellBorderObject.x = this.objectX - this.brdSizeNormal;
      this.cellBorderObject.y = this.objectY - this.brdSizeNormal;
      this.cellBorderObject.width = this.objectWidth + 2*this.brdSizeNormal;
      this.cellBorderObject.height = this.objectHeight + 2*this.brdSizeNormal;
    }
    
    this.updateCursorPos();
  }
  
  function disableObject(){
    this.disableInput = true;
    
    if(this.objectBgColorDisable){
      this.objectContent.bkgColor = this.objectBgColorDisable;
    } else if(this.objectBgColor){
      this.objectContent.bkgColor = this.objectBgColor;
    }
      
    if (this.txtStyleDisable){
      this.objectContent.style = this.txtStyleDisable;
    } else if (this.txtStyleNormal){
      this.objectContent.style = this.txtStyleNormal;
    }
      
    if (this.imgCursor != null){
      this.imgCursor.enable  = false;
      this.imgCursor.visible = false;
    }
    
    if (this.cellBorderObject){
      this.cellBorderObject.bkgColor = this.brdClrNormal;
      this.cellBorderObject.x = this.objectX - this.brdSizeNormal;
      this.cellBorderObject.y = this.objectY - this.brdSizeNormal;
      this.cellBorderObject.width = this.objectWidth + 2*this.brdSizeNormal;
      this.cellBorderObject.height = this.objectHeight + 2*this.brdSizeNormal;
    }
  }
  
  function doCompleteActions() {
    clearTimeout(this.timer_id);
    this.timer_id = 0;
    if(this.onInputBoxCompleteActions){
      for(var i = 0; i < this.onInputBoxCompleteActions.length; i++){
        parent.dispatchAction(this.onInputBoxCompleteActions[i]);
      }
    }  
  }
  
  function doWrongActions() {
    clearTimeout(this.timer_id);
    this.timer_id = 0;
    if(this.onInputBoxWrongActions){
      for(var i = 0; i < this.onInputBoxWrongActions.length; i++){
        parent.dispatchAction(this.onInputBoxWrongActions[i]);
      }
    }  
  }
  
// Вспомогательные функции
// onSetFocus
// onKillFocus
  function onSetFocusHandlerAlias(){
    onSetFocusHandler();
  }
  
  function onSetFocusHandler(){
    if (this.OnSetFocus)
      this.OnSetFocus();
  }
  
  function onKillFocusHandlerAlias(){
    onKillFocusHandler();
  }
  
  function onKillFocusHandler(){
    if (this.OnKillFocus)
      this.OnKillFocus();
  }
  
  function isTestObject(){
    return this.is_test_this;
  }
  
  function setError(){
    this.lastStateCheck = 2;
    ++this.objectErrors;
    trace("#FF0000this.objectErrors = "+this.objectErrors);
    
    if (this.txtStyleError != null){
      this.objectContent.style = this.txtStyleError;
    }
    
    if (this.cellBorderObject){
      this.cellBorderObject.bkgColor = this.brdClrError;
      this.cellBorderObject.x = this.objectX - this.brdSizeError;
      this.cellBorderObject.y = this.objectY - this.brdSizeError;
      this.cellBorderObject.width = this.objectWidth + 2*this.brdSizeError;
      this.cellBorderObject.height = this.objectHeight + 2*this.brdSizeError;
    }
  }
  
  function setReadOnly(state){
    this.isReadOnly = state;
  }
  
  function getResult(resultsArray){
    if (this.check_res_is_true){
      var results;
      results = new scene.Utils.resultParam();
      results.init();
      
      results.rightElements = this.lastStateCheck == 1 ? 1 : 0;
      results.allRightElements = 1;
      results.wrongElements = this.lastStateCheck == 2 ? 1 : 0;
      results.allWrongElements = 1;
      results.allElements = "unknown";
      results.attemptsCount = getErrors();
      results.isTimeout = this.isOnTimeout;
      
      results.countResult(this.crAlgorithm);
      
      this.objectResult = results.objectResult;//Math.round(100/(this.objectErrors+1));
    } else {
      this.objectResult = 0;
    }
      
    if (resultsArray && this.crAlgorithm != "none"){
    var resultString = this.objectResult + ";1.0";
    resultsArray.push(resultString);
    }
    
    trace("#FF0000resultString = "+resultString);
  }
  
  function getErrors(){
    return this.objectErrors;
  }
  
  function getHelps(){
    return 0;
  }
]]></script>
</composition>
</rmml>