Re: Cannot get realize() events on GtkViewport created by libglade



On Mon, 2007-07-23 at 10:41 -0500, david hagood gmail com wrote:
[...]
   - Add a widget to your project that your custom widget derives from,
     for example, GtkLabel for MyCustomLabel
   - search/replace occurences of <widget class="GtkLabel".. for
     <widget class="MyCustomLabel".. in the glade file
   - use glade_xml_register_widget() to tell libglade about
     MyCustomLabel (look at glade-gtk.c from libglade for examples
     of glade_xml_register_widget() & register_custom_prop() funcs).

I've done that. However, I then lose the ability to edit the glade file
with Gazpacho, as it will a) not show my widget, and b) remove it when I
save the file.

What kind of widget are you trying to add ? is it a container type ?
It's derived from the GtkDrawingArea - it will be an oscilloscope display.


See below, I'm including an example glade catalog file that should
get your widget recognized in no time...

I would say that "realize" time is a bad time for rebuilding/reparenting
your widget hierarchy, "realize" is when objects allocate thier gdk
backend resources.

Well, the problem is that I didn't see any other way to get a hold of a
widget at something like construction time, given that I am using
libglade.


If your toplevel widget is visible=True in the glade file then
it will be shown by the time glade_xml_new() returns, so all
the realize handlers have already run before ever connecting
to the signal... if you hide the toplevel and do gtk_window_present()
yourself then you'll be able to get the signal.
However, I am hooking the events during the construction of the widgets,
by using glade_xml_signal_autoconnect_full with my own handler function,
so I would think this would allow the events to be hooked as the widget is
constructed but before it is realized - is that not the case?


Cheers,
                -Tristan

Ok so here is your custom widget catalog for glade
 <snip> I'll try this. Thanks

BTW: I had been directed to try asking questions in IRC, but when I went
there things seemed pretty dead - either that or I wasn't doing something
wrong (this is my first time using IRC).




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