Re: Creating a new widget after the program has started.



J. Davison de St. Germain wrote:

Hi,

  In our application, we sometimes create new widgets after the
program is up and running.  (These new widgets are GL Windows.)
However, when we try to bind events to them (eg: have them catch mouse
clicks), they don't respond.  Does anyone know if this is something
that should just work?  Or is it a known problem?  Any ideas would
help us greatly.

Just an idea: are you sure that your widgets have the right event mask ?
If you want to catch mouse clicks you have to connect to "button-press-event" signal and also call gtk_widget_add_events() function with GDK_BUTTON_PRESS_MASK
as a second parameter.
Consider:
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-add-events
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-set-events

You also can take a look at examples coming with gtk like "scribble-simple" and "eventbox".

Olexiy





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]