[gtkada] Putting an XMP graphic on a button
Grein, Christoph
christoph.grein at eurocopter.com
Mon Jun 10 13:20:34 CEST 2002
This is generated Ada code from glade. The main window holds just one button
without text, which I want to adorn with an XPM pixmap.
So I edited the generated Fsms_Gui procedure by adding Set_Button_Pixmap to it.
If I call Set_Button_Pixmap at the place (1) I get the message "Gdk-WARNING **:
Creating pixmap from xpm with NULL window and colormap", but the button is
adorned with the graphic.
At position (2), I get no warning and also no graphic on the button.
What is wrong/missing?
with Gtk; use Gtk;
with Gtk.Main;
with Gtk.Widget; use Gtk.Widget;
with F_Smedit_Pkg; use F_Smedit_Pkg;
with Gdk.Bitmap, Gdk.Pixmap, Gdk.Color, Gtk.Button, Gtk.Pixmap; -- added
procedure Fsms_Gui is
procedure Set_Button_Pixmap is
Pixmap : Gdk.Pixmap.Gdk_Pixmap;
Mask : Gdk.Bitmap.Gdk_Bitmap;
Graphic: Gtk.Pixmap.Gtk_Pixmap;
begin
Gdk.Pixmap.Create_From_Xpm (Pixmap,
Gtk.Button.Get_Window
(F_Smedit.Current_State_Scroll_Up),
Mask,
Transparent => Gdk.Color.Null_Color,
Filename => "Up.xpm");
Gtk.Pixmap.Gtk_New (Graphic, Pixmap, Mask);
Gtk.Button.Add (F_Smedit.Current_State_Scroll_Up, Graphic);
end Set_Button_Pixmap;
begin
Gtk.Main.Set_Locale;
Gtk.Main.Init;
Gtk_New (F_Smedit);
-- Set_Button_Pixmap; -- (1)
Show_All (F_Smedit);
-- Set_Button_Pixmap; -- (2)
Gtk.Main.Main;
end Fsms_Gui;
More information about the gtkada
mailing list