如何查找键盘是否覆盖控件

时间:2015-12-06 04:30:05

标签: livecode

我有一个代码,可以在激活键盘时移动一组控件。但我只希望它在键盘覆盖激活键盘的控件时运行。我正在使用下面的代码,但它无法正确确定控件何时被键盘隐藏。

堆栈脚本

lStackSize,lStackHeight
global gBottom

on openstack

   set the fullscreenmode of me to "exactFit" 
   put the loc of group "controls" into lStackLoc
   put the effective working screenRect into lStackSize
   put item 4 of lStackSize - item 2 of lStackSize  into lStackHeight

end openstack

-------------------------------

on keyboardactivated

   answer "control bottom" && gbottom

   put the effective working screenRect into tStackSize
   set itemdel to comma
   put item 4 of tStackSize - item 2 of tStackSize  into tStackHeight

    answer "tStackHeight" && tStackHeight & return & "gbottom" && gBottom

    if gbottom<tStackHeight then

       answer "control Visible"

    else 

        answer"control Hidden"
        put gbottom - tStackHeight into tYMove
        put item 2 of lStackLoc - tYMove into tNewLocY
        put item 1 of lStackLoc & "," & tNewLocY into tStackLoc
        move group "controls"  to tStackLoc 

    end if


end keyboardactivated

---------------------------

on keyboardDeactivated

   move group "controls"  to lStackLoc

end keyboardDeactivated

控制脚本

global gBottom

on openfield

  put  the bottom of me into gBottom

end openfield

1 个答案:

答案 0 :(得分:0)

有效的screenRect指的是屏幕上实际可用的矩形(可见应用程序实际使用的屏幕部分)。工作screenRect是屏幕的一部分,例如,不被屏幕使用。状态栏。

        $_SESSION['logged_in2'] = false;
    if( !empty( $data ) ){

        // Trim all the incoming data:
        $trimmed_data = array_map('trim', $data);

        // escape variables for security
        $email = mysqli_real_escape_string( $this->_con,  $trimmed_data['email'] );
        $password = mysqli_real_escape_string( $this->_con,  $trimmed_data['password'] );

        if((!$email) || (!$password) ) {
            throw new Exception( PARENTS_FIELDS_MISSING );
        }
        $password = md5( $password );

        $query = "SELECT parent_id, email FROM parents where email = '$email' and password = '$password' union all SELECT name FROM users ";
        $result = mysqli_query($this->_con, $query);
        $data = mysqli_fetch_assoc($result);
        $count = mysqli_num_rows($result);
        mysqli_close($this->_con);
        if( $count == 1){
            $_SESSION = $data;
            $_SESSION['logged_in2'] = true;
            return true;
        }else{
            throw new Exception( PARENTS_FAIL );
        }
    } else{
        throw new Exception( PARENTS_FIELDS_MISSING );
    }

put the effective working screenRect into myRect if the topleft of control x is not within myRect \ or the bottomright of control x is not within myRect then // control x is outside the visible part of the window end if 可能就足够了,但在讨论The working screenRect

时,文档特别指的是键盘