Re: Notebook image problem



Dear Mike,

If I use a hbox, the tabs are not visible. I merely see small areas where tabs should have been.

Here is the code I've used:

box = gtk_hbox_new(FALSE, 2);
image = gtk_image_new_from_file("image-location");
label = gtk_label_new("New Label");

gtk_box_pack_start(GTK_BOX(box), image, TRUE, TRUE, 3);
gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 3);

gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), frame, GTK_WIDGET(box), 3);

Thanks for the help.

Antonio B.

On Feb 2, 2008 4:13 PM, Mike Massonnet <mmassonnet gmail com> wrote:
On Sat, Feb 02, 2008 at 03:48:59PM +0530, Antonio Bassinger wrote:
> Hi All,
>
> Good Day!
>
> I am new to GTK, and after googling for many hours I couldn't find an answer
> to my query. Hope you people can help.
>
> I have a notebook. I wish to add images to the notebook tags. I have used
>
> *gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), frame, label, 3);
>
> *Instead of label, if I use a button, I face a problem of dealing with so
> many buttons. Code shown below:
>
> *button = gtk_button_new_with_label(buffer);*
> *image = gtk_image_new_from_file("/usr/share/XYZ.ppm");*
> *gtk_button_set_image(GTK_BUTTON(button), image);*
> *gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), frame, button, 3);*
>
> Maybe someone has an idea how to show a label and a image?

Why, oh why would you put a button inside the tabs?  Instead of the
button simply use an hbox and pack inside it an image and a label.

> Many Thanks
> Antonio

mike



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