PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<ncurses_getmaxyxncurses_getyx>
Last updated: Sat, 20 Oct 2007

ncurses_getmouse

(PHP 4 >= 4.2.0, PHP 5)

ncurses_getmouse -- Reads mouse event

Description

bool ncurses_getmouse ( array &mevent )

警告

本函数是实验性的。本函数的行为,包括函数名称以及其它任何关于本函数的文档可能会在没有通知的情况下随 PHP 以后的发布而改变。使用本函数风险自担。

ncurses_getmouse() reads mouse event out of queue. Function ncurses_getmouse() will return ;FALSE if a mouse event is actually visible in the given window, otherwise it will return TRUE. Event options will be delivered in parameter mevent, which has to be an array, passed by reference (see example below). On success an associative array with following keys will be delivered:

  • "id" : Id to distinguish multiple devices

  • "x" : screen relative x-position in character cells

  • "y" : screen relative y-position in character cells

  • "z" : currently not supported

  • "mmask" : Mouse action

例子 1. ncurses_getmouse() example

<?php
switch (ncurses_getch()){
  case
NCURSES_KEY_MOUSE:
   if (!
ncurses_getmouse(&$mevent)){
     if (
$mevent["mmask"] & NCURSES_MOUSE_BUTTON1_PRESSED){
      
$mouse_x = $mevent["x"]; // Save mouse position
      
$mouse_y = $mevent["y"];
     }
   }
  break;

  default:
  
/* .... */
}
?>

See also ncurses_ungetmouse()




<ncurses_getmaxyxncurses_getyx>
 Last updated: Sat, 20 Oct 2007
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST