[Glade-users] Drawing area click signal
Tristan Van Berkom
Tristan Van Berkom <tristan.van.berkom@gmail.com>
Mon, 13 Dec 2004 11:42:44 -0500
On Mon, 13 Dec 2004 11:22:36 -0500, Jeff Simpson <llcooljeff@gmail.com> wrote:
> I'm using Glade-2 and gtkmm to develop a C++ gtk application. I am
> having trouble getting some signals to work. I make the object in
> glade, assign a signal to a function, save and build. The function
> prototype shows up in the code, but no matter what I put into the
> function, it doesn't execute. Here's a breakdown of my results:
>
> toggle button: click event works
> normal button: click doesn't work
> window: can't find any event that means "created" or "show" that works
> drawing area: click doesn't work, show doesn't work
> menus: won't compile with menus
>
> Can anybody point me in a direction where I could find a way to make
> some of these things work? I know when I was using C with glade, I had
> to put in a single-line to enable the click signal on the drawing
> area, but I can't find a parallel in C++. Thanks!
glade-2 allows you to set "Events" in the common tab of the property editor.
To recieve "button-press-event" on a drawing area, be sure to mark it
with GDK_BUTTON_PRESS_MASK.
If you want to know what "signal" is appropriate for what "GObject", this is the
approach I use, always browse the doc using this page:
http://developer.gnome.org/doc/API/2.0/gtk/ch01.html
Pay special attention to "Object Hierarchy" section of every api documentation
page, example; gtkbutton API says:
GObject
+----GtkObject
+----GtkWidget
+----GtkContainer
+----GtkBin
+----GtkButton
This means that all the functions & signals listed in the API for
GObject, GtkObject,
GtkWidget, GtkContainer & GtkBin are valid for the GtkButton.
Cheers,
-Tristan