[gtkada] Changing a pixmap

Jean-Pierre Rosen rosen at adalog.fr
Thu Mar 27 13:24:34 CET 2003


> > I have a user interface (with GTKAda of course), generated with glade, that includes a pixmap, and I want to
> > change dynamically the picture (typically, changing a green "light" to red).
> > 
> > I did something like:
> >          Control_Window.Modif_Status := GTK.Pixmap.Create_Pixmap ("pixmaps/red.xpm",
> >                                                                            Control_Window_Pkg.Control_Window);
> 
> 
> You need to put the pixmap in some container on the screen, maybe
> replacing the previous one
> If Control.Window.Modif_Status is the one created by Glade, you might
> want to use Gtk.Pixmap.Set instead, to replace the existing one
> 
The pixmap is in a Packer (and was generated from Glade).
Part of the trouble is that Gtk.Pixmap is not documented in the (otherwise excellent)
reference manual.
How to use set is not obvious...  It refers to Gdk.Pixmaps, so you have to create a Gdk.pixmaps from file first.
But then, you must pass it a window. Which one? etc. I certainly can sort it out by trial and error, but it looks
awfully complicated for my need, which is:

"I have a picture of a red button and a picture of a green button in XPM format. I want to display sometimes red,
sometimes green".

NB: I'm using GTK 1.2.12/Linux 1.3.12/Win.
---------------------------------------------------------
           J-P. Rosen (rosen at adalog.fr)
Visit Adalog's web site at http://www.adalog.fr



More information about the gtkada mailing list