FML/Script/Features/ToggleInterface.php
protected function getKeyPressScriptText()
    {
        $scriptText  = null;
        $keyProperty = null;
        $keyValue    = null;
        if ($this->keyName) {
            $keyProperty = "KeyName";
            $keyValue    = Builder::getText($this->keyName);
        } else if ($this->keyCode) {
            $keyProperty = "KeyCode";
            $keyValue    = Builder::getInteger($this->keyCode);
        }
        $scriptText = "
if (Event.{$keyProperty} == {$keyValue}) {
";
        if ($this->control) {
            $controlId  = Builder::escapeText($this->control->getId());
            $scriptText .= "
    declare ToggleInterfaceControl <=> Page.GetFirstChild({$controlId});";
        } else {
            $scriptText .= "
    declare ToggleInterfaceControl <=> Page.MainFrame;";
        }
        $scriptText .= "
    ToggleInterfaceControl.Visible = !ToggleInterfaceControl.Visible;";
        if ($this->rememberState) {
            $stateVariableName = static::VAR_STATE;
            $scriptText        .= "
    declare persistent {$stateVariableName} as CurrentState for LocalUser = True;
    CurrentState = ToggleInterfaceControl.Visible;
";
        }
        return $scriptText . "
}";
    }
protected function getKeyPressScriptText()
    {
        $scriptText  = null;
        $keyProperty = null;
        $keyValue    = null;
        if ($this->keyName) {
            $keyProperty = "KeyName";
            $keyValue    = Builder::getText($this->keyName);
        } else if ($this->keyCode) {
            $keyProperty = "KeyCode";
            $keyValue    = Builder::getInteger($this->keyCode);
        }
        $scriptText = "
if (Event.{$keyProperty} == {$keyValue}) {
";
        if ($this->control) {
            $controlId  = Builder::escapeText($this->control->getId());
            $scriptText .= "
    declare ToggleInterfaceControl <=> Page.GetFirstChild({$controlId});";
        } else {
            $scriptText .= "
    declare ToggleInterfaceControl <=> Page.MainFrame;";
        }
        $scriptText .= "
    ToggleInterfaceControl.Visible = !ToggleInterfaceControl.Visible;";
        if ($this->rememberState) {
            $stateVariableName = static::VAR_STATE;
            $scriptText        .= "
    declare persistent {$stateVariableName} as CurrentState for LocalUser = True;
    CurrentState = ToggleInterfaceControl.Visible;
";
        }
        return $scriptText . "
}";
    }
protected function getKeyPressScriptText ( ) { $ scriptText = null ; $ keyProperty = null ; $ keyValue = null ; if ( $ this -> keyName ) { $ keyProperty = "KeyName" ; $ keyValue = Builder :: getText ( $ this -> keyName ) ; } else if ( $ this -> keyCode ) { $ keyProperty = "KeyCode" ; $ keyValue = Builder :: getInteger ( $ this -> keyCode ) ; } $ scriptText = "
if (Event.{$keyProperty} == {$keyValue}) {
" ; if ( $ this -> control ) { $ controlId = Builder :: escapeText ( $ this -> control -> getId ( ) ) ; $ scriptText .= "
    declare ToggleInterfaceControl <=> Page.GetFirstChild({$controlId});" ; } else { $ scriptText .= "
    declare ToggleInterfaceControl <=> Page.MainFrame;" ; } $ scriptText .= "
    ToggleInterfaceControl.Visible = !ToggleInterfaceControl.Visible;" ; if ( $ this -> rememberState ) { $ stateVariableName = static :: VAR_STATE ; $ scriptText .= "
    declare persistent {$stateVariableName} as CurrentState for LocalUser = True;
    CurrentState = ToggleInterfaceControl.Visible;
" ; } return $ scriptText . "
}" ; }
Get the key press script text

@return string
Get the key press script text