Re: images inside labels



You guys are going to kill me. I have figured it out, with
the help of all of you. The biggest thing was not actually
showing the hbox (thx Hazael, sorry Paul). I was figuring, I guess
that doing gtk_widget_show_all(window) would be enough
to show "everything". I was mistaken. Below is a snip of the
code that I've used to make this happen now. Works like a
charm. Thanks to all who helped.


Travis

[code]
   hbox= gtk_hbox_new(FALSE, 5);
   icon = gtk_image_new_from_stock(
GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_SMALL_TOOLBAR);
   label= gtk_label_new("Label");

   gtk_box_pack_start(GTK_BOX (hbox), icon,
       FALSE, FALSE, 0);
   gtk_box_pack_start(GTK_BOX (hbox), label,
       FALSE, FALSE, 0);

   gtk_notebook_append_page(
       GTK_NOTEBOOK (notebook), scroll, hbox);

   gtk_widget_show_all(hbox);
[/code]



----- Original Message ----- From: "Hazael Maldonado Torres" <gtk-development itxolutions com>
To: <devel oberonwireless com>; <gtk-app-devel-list gnome org>
Sent: Tuesday, January 31, 2006 11:34 AM
Subject: Re: images inside labels


Hi there

I had done something similar but adding a label+button. Below you can find the code I used.

    hbox2 = gtk_hbox_new (FALSE, 4);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), hbox2); label4 = gtk_label_new (_("Population 1"));
   gtk_box_pack_start (GTK_BOX (hbox2), label4, FALSE, FALSE, 0);
button2 = gtk_button_new ();
   gtk_box_pack_start (GTK_BOX (hbox2), button2, FALSE, FALSE, 0);
   gtk_widget_set_size_request (button2, 16, 16);
   gtk_button_set_relief (GTK_BUTTON (button2), GTK_RELIEF_NONE);
   gtk_button_set_focus_on_click (GTK_BUTTON (button2), FALSE);
image2 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
   gtk_container_add (GTK_CONTAINER (button2), image2);

   gtk_widget_show_all (hbox2);


Hope it helps

Regards

Hazael





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