Accelerator to close window
| From: | FOURTICQ Benjamin | Date: | Fri, 21 Oct 2005 08:47:38 +0000 |
| Subject: | Accelerator to close window | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-6256@lists.php.net to get a copy of this message | ||
Hello,
Is it possible to have a single GtkWindow and bind a key to close it. I mean without having any button nor menuitem, is it possible to bind Ctr-X to close a window ?
I tried :
$this->_accel_group = &new GtkAccelGroup();
$this->dialog->add_accel_group ($this->_accel_group);
$this->dialog->add_accelerator ("destroy", $this->_accel_group, GDK_KEY__x, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
... But doesn't work
$btnExit = new GtkButton(); // Button not visible
$this->_accel_group = &new GtkAccelGroup();
$this->dialog->add_accel_group ($this->_accel_group);
$btnExit->add_accelerator ("clicked", $this->_accel_group, GDK_KEY__x, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
... But doesn't work
Any idea ?
Thanks in advance,
Benjamin FOURTICQ.