Pixmap (II)



Hi!

I've read your solution, but I haven't obtained the correct answer.

My drawable routine is the next:

 GdkBitmap *masc; // Mascara de bits
 GtkStyle *stile; // Estilo
 stile = gtk_widget_get_style(window);
pixmap=gdk_pixmap_create_from_xpm(window->window,&masc,&stile->bg[GTK_STATE_NORMAL],"gtk.xpm"); //pixmap is a GdkPixmap and gtk.xpm is the new path of the new image
 pixmapwid= gtk_pixmap_new (pixmap, masc); //pixmapwid is a GtkWidget
 gtk_widget_queue_draw_area(pixmapwid,0,0,900,400);
 gtk_widget_show(pixmapwid);

But seems it's not correct. Have I any erro?

Thanks!!

============================================

hi,

one possible paradigm is to adhere to the following guidelines:

1) the configure event callback is responsible for calling all routines responsible for "drawing" the pixmap for ultimate display, but does NOT do the actual display to the screen;

2) the expose event callback is responsible for rendering the current pixmap to be displayed to the screen, but does NO "drawing" here, only render the pixmap to the screen via gdk_draw_drawable() or equivalent;

3.1) the drawing routine(s) are responsible for creating the pixmap for ultimate display;

3.2) store the address of the pixmap in a variable that the expose event callback also has access to (global or otherwise)

3.3) the last command as part of the drawing routine is to call gtk_widget_queue_draw_area() on the widget used to display
the pixmap; this will force an expose event

in this manner, your drawing routine is called on all configure events followed immediately by the expose event rendering the pixmap to the screen. while calling your drawing routine via a user-event, or some other event internal to the program, will also result in the expose event being called to render the newly made pixmap to the screen.

so, in your case, you would attach the button-click to a callback ultimately calling your pixmap drawing routine. the drawing routine will then be called on button-click and your new pixmap will be rendered via the expose event.

cheers,

richard

On Aug 2, 2006, at 11:43 AM, Roses Roses wrote:

	 	Hi!!!

I'm programming a little interface but I have a  prblem. The  objective of
this program is shows a pixmap qhich must ghange qhen the user  clicks on  a
button. How the fuction of the button can change the pixmap assigned?

One idea I've is declare  the GtkPixmap as a global variable, but  I'm not
sure if this plan can run.

Thank you very much

_________________________________________________________________
Horóscopo, tarot, numerología... Escucha lo que te dicen los astros. http://astrocentro.msn.es/




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