[gtk-list] Re: Button with Image for Toolbar
- From: Sascha Ziemann <szi aibon ping de>
- To: gtk-list redhat com
- Subject: [gtk-list] Re: Button with Image for Toolbar
- Date: Sat, 10 May 1997 22:05:02 +0200
Owen Taylor wrote:
> Perhaps the problem is that the pixmap is shown before it's parent
> widget (the button) has a parent. I've sometimes had problems like
> this. (It probably needs fixing, at least to give an informative
> error message - the "bad match" comes later because X data structures
> have been corrupted.)
gtk_button_new_with_label does it in that way. I do not think that it
will be wrong.
This works:
button = gtk_button_new ();
bitmap = gdk_bitmap_create_from_data (NULL,
eject_bits,
eject_width, eject_height);
/* pixmap = gtk_pixmap_new (bitmap, bitmap, bitmap, bitmap, bitmap);*/
pixmap = gtk_label_new("Tach");
gtk_widget_show(pixmap);
gtk_container_add (GTK_CONTAINER (button), pixmap);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 5);
gtk_widget_show (button);
But this produces a core:
button = gtk_button_new ();
bitmap = gdk_bitmap_create_from_data (NULL,
eject_bits,
eject_width, eject_height);
pixmap = gtk_pixmap_new (bitmap, bitmap, bitmap, bitmap, bitmap);
/* pixmap = gtk_label_new("Tach");*/
gtk_widget_show(pixmap);
gtk_container_add (GTK_CONTAINER (button), pixmap);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 5);
gtk_widget_show (button);
Quite strange. But in the end I found that this does work:
button = gtk_button_new ();
style = gtk_widget_get_style(button);
pixmap1 = gdk_pixmap_create_from_xpm(window->window,
&style->bg[GTK_STATE_NORMAL],
"xpm/eject.xpm");
pixmap = gtk_pixmap_new (pixmap1, pixmap1, pixmap1, pixmap1, pixmap1);
gtk_container_add (GTK_CONTAINER (button), pixmap);
gtk_widget_show(pixmap);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 5);
gtk_widget_show (button);
-- bis später...
- Sascha ---<~>=( http://www.ping.de/sites/aibon/ )=<~>---
() Free speech online
/\ http://www.eff.org/BlueRibbon/bluehtml.html
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]