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: Thu, 26 Jun 2008

ncurses_getmouse

(PHP 4 >= 4.2.0, PHP 5, PECL ncurses:1.0.0)

ncurses_getmouse — Reads mouse event

Description

bool ncurses_getmouse ( array &$mevent )
Warning

This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.

ncurses_getmouse() reads mouse event out of queue.

Parameters

mevent

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.

Examples

Example #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:
  
/* .... */
}
?>



add a noteadd a note User Contributed Notes
Reads mouse event
There are no user contributed notes for this page.




<ncurses_getmaxyxncurses_getyx>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs