[Glade-users] Changing the image of a pixmap
- From: damon helixcode com (Damon Chaplin)
- Subject: [Glade-users] Changing the image of a pixmap
- Date: Thu, 05 Oct 2000 00:46:14 +0100
Chris Freeze wrote:
I'm creating a dialog in glade that has a few buttons and a pixmap. I've been
able to change the text of the buttons but not able to change the image that's
displayed.
The following code segfaults inside of gdk_bitmap_ref. I've seen how to do
this using just Gtk code, but not with a glade generated object. Any
suggestions on where I am going wrong?
GtkWidget *Pixmap;
GtkStyle *Style;
GdkPixmap *Image;
GdkBitmap *ImageMask;
Style = gtk_widget_get_style(lookup_widget(Dialog,"dialog_widget"));
Image =
gdk_pixmap_create_from_xpm(lookup_widget(Dialog,"dialog_widget")->window,
ImageMask,
&lookup_widget(Dialog,"dialog_widget")->style->bg[GTK_STATE_NORMAL],
"error32.xpm");
//image is the name given to the pixmap entry in glade
gtk_pixmap_set(GTK_PIXMAP(lookup_widget(Dialog,"image")),Image,ImageMask);
The mask argument to gdk_pixmap_create_from_xpm() should be a GdkBitmap **mask
rather than a GdkBitmap *mask. Didn't the compiler warn about this?
Also if you are using the mask, you don't need to worry about the transparent
color.
So this may be better:
dialog_widget = lookup_widget(Dialog,"dialog_widget")
Image = gdk_pixmap_create_from_xpm (dialog_widget->window, &ImageMask,
NULL, "error32.xpm");
//image is the name given to the pixmap entry in glade
gtk_pixmap_set(GTK_PIXMAP(lookup_widget(Dialog,"image")),Image,ImageMask);
Damon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]