Handling events in custom widgets
- From: "Teodosiy Kirilov" <tdik123 googlemail com>
- To: gtkmm-list gnome org
- Subject: Handling events in custom widgets
- Date: Fri, 20 Jun 2008 14:02:43 +0200
I'm trying to create a custom widget, which needs to also handle
keyboard and mouse input.
Basically I'm doing the same as the example in chapter 25.2 from the
book, but I have 3 instances of my widget - e.g
| Gtk::Paned* pane1 = new Gtk::HPaned;
| Gtk::Paned* pane2 = new Gtk::VPaned;
| Gtk::Widget* w1 = new MyWidget();
| Gtk::Widget* w2 = new MyWidget();
| Gtk::Widget* w3 = new MyWidget();
| add(m_VBox);
| m_VBox.pack_start(*Gtk::manage(pane1), Gtk::PACK_EXPAND_WIDGET);
| pane1->pack1(*Gtk::manage(w1), Gtk::EXPAND);
| pane1->pack2(*Gtk::manage(pane2), Gtk::EXPAND);
| pane2->pack1(*Gtk::manage(w2), Gtk::EXPAND);
| pane2->pack2(*Gtk::manage(w3), Gtk::EXPAND);
So what I try to do is handle keyboard and mouse input in the widget
under the mouse cursor - just like other widgets (e.g Gtk::Entry)
The problem is the event handlers in the MyWidget-Class (e.g
on_key_press_event) are not triggered at all. If I set the
CAN_FOCUS-flag of MyWidget, the w1 handles the keyboard input. I've
tried other flags, but with no success.
Setting event mask of the Gdk::Window
appropriately(m_refGdkWindow->set_events(...)) didn't help also.
What do I need to do in order to get my widget signaled when keyboard
and mouse events occur?
Thanks in advance
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]