Right clicking and clists
| From: | (Aaron Bishell) | Date: | Sun, 30 Mar 2003 12:22:15 +0000 |
| Subject: | Right clicking and clists | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-3183@lists.php.net to get a copy of this message | ||
I managed to get the row being selected on a clist when the right mouse
button is clicked so I thought id post the code incase anyone else needs
it:
---
$clist->connect("button-press-event", "buttonPressEventCallback",
$a_gtk_menu);
function buttonPressEventCallback($clist, $event, & $menu)
{
// If the right button was pressed.
if ( ($event->button == 3) )
{
list($row, $column)=$clist->get_selection_info($event->x, $event->y);
// If a valid row was right clicked.
if( (is_int($row)) && (is_int($column)) )
{
// Select this row.
$clist->select_row($row, $column);
// Popup the menu.
$menu->popup(NULL, NULL, NULL, $event->button, $event->time);
}
}
}
---
I had a difficult time finding how to do this so enjoy :)