Finding the width of a GnomeCanvas



My apologies for the cross-post to both the gnome-devel and gtk-app-devel
lists, but I felt this was obscure enough that it was warranted.

I'm trying to find the width (and height) of a GnomeCanvas so I can determine
its center point.  I've been find this by fetching the "width" GtkArg from
the widget, but I always get a 0 back.  In fact, I get a 0 back when I try on
a scrolled window, on a vbox, on a clist, on a column label in a clist, and
on a button in the toolbar.  The only time I get a nonzero result is with a
GtkHScale.

Here's the relevant code (note that I'm using some custom C++ wrappers, but
they aren't the culprit here):

    GnomeCanvas *canv = GNOME_CANVAS(canvas.ptr());
    GtkArg arg;
    arg.name = "width";
    gtk_widget_get(GTK_WIDGET(canv), &arg);
    cout << "Widget width: " << GTK_VALUE_INT(arg) << endl;

So, does anyone have any ideas as to how to reliably determine the width of a
widget (specifically, a GnomeCanvas)?

Thanks in advance,
James

--
There is no spoo.




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