Needing a sample code based on following API's (regarding pixmaps)



I need to create a pixmap-drawn stop watch, so that each pixmap reflects one
digit (i.e. 00:00). Thus I need to create a pixmap widget that will be
changeable after the program has started running.

I am trying to use the following code:

in main()

GtkWidget *pixmap1; //let's say this sample program has only one digit to
worry about
GtkWidget *window1; //main window
GdkPixmap *pixmapdata; //data to be converted to pixmap widget

...

pixmapdata = gdk_pixmap_create_from_xpm (???, NULL, NULL, "test/zero.xpm");
pixmap1 = gtk_pixmap_new (pixmapdata, NULL);
gtk_widget_show(pixmap1);

...

In the place of ??? I tried putting window1 and NULL. Neither yielded
results. I am using NULL for colormap and mask, since they are (according to
API specs) not necessary (please correct me if I am wrong). Here are the
errors I get:

Gtk-CRITICAL: file gtkpixmap.c line 97 (gtk_pixmap_new) assertion 'val !=
NULL' failed
        (gtk_widget_show): assertion 'widget != NULL' failed
        (gtk_box_pack_start): assertion 'child != NULL' failed

Obviously this is a cascading error stemming from the issue that pixmapdata
for some reason ends up being null. I am 100% sure that it is not the file
location. So, could someone please help me with this one? Thank you!

Sincerely,

Ivica "Ico" Bukvic, composer
http://meowing.ccm.uc.edu/~ico/
http://bukvicrh.dyndns.org/ico/
ico fuse net
============================
"To be is to do" - Socrates
"To do is to be" - Sartre
"Do be do be do" - Sinatra
"Just do it!"    - NIKE






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