Re: Bring a widget to the foreground



Hi.

I followed that link but it doesn't look as if it would work for a button. ÂI'd need to be able to get the 
button's label object (if there is one) but I can't see an obvious way of getting it.... Â:-(

How you'll get your hands on GtkLabel object inside button depends on
how your button has been constructed. The safest and simplest way of
doing this would be to manually add label to your button using code
like this:

/* *** CODE ***
button = gtk_button_new ();
label = gtk_label_new ("Label");
gtk_container_add (GTK_CONTAINER (button), label);
/* *** end CODE ***

If this approach is not right for your situation, you'll need to walk
the widget hierarchy in the button until you find your label.
Hierarchies as produced by different constructors are (I'm almost
certainly wrong here, but I'm sure someone will correct me):

gtk_button_new_with_label(): button->label
gtk_button_new_from_stock(): button->hbox->label
                                         `>image

Exact widget tree doesn't really matter, since it's relatively easy to
create code that recursively checks for GtkLabel.

Hope this helps a bit.

Tadej
-- 
Tadej BorovÅak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com



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