JavaScript Editor Javascript debugger     Website design 


Reads mouse event (PHP 4 >= 4.2.0, PHP 5, PECL ncurses:1.0.0)
bool ncurses_getmouse ( array &mevent )


This function is EXPERIMENTAL. The behaviour of this function, the name of this function, and anything else documented about this function may change without notice in a future release of PHP. Use this function at your own risk.

ncurses_getmouse() reads mouse event out of queue.



Event options will be delivered in this parameter 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

Return Values

Returns FALSE if a mouse event is actually visible in the given window, otherwise returns TRUE.


Example 1589. ncurses_getmouse() example

switch (ncurses_getch()){
   if (!
     if (
$mevent["mmask"] & NCURSES_MOUSE_BUTTON1_PRESSED){
$mouse_x = $mevent["x"]; // Save mouse position
$mouse_y = $mevent["y"];

/* .... */