[gtkada] Putting an XMP graphic on a button

Grein, Christoph christoph.grein at eurocopter.com
Mon Jun 17 07:36:43 CEST 2002


> Try add: 
>
> >     Gtk.Pixmap.Gtk_New (Graphic, Pixmap, Mask);
> >     Gtk.Button.Add (F_Smedit.Current_State_Scroll_Up, Graphic);
>
> Show (F_Smedit.Current_State_Scroll_Up)
>
> >   end Set_Button_Pixmap;
>
> And put the call in position (2)

No, does not help, button is still empty. Code is below:

procedure Fsms_Gui is

  procedure Set_Button_Pixmap is
    -- At (1): "Gdk-WARNING **: Creating pixmap from xpm with NULL window
    --         and colormap", but button with graphic
    -- At (2): No warning and no graphic on button
    Pixmap : Gdk.Pixmap.Gdk_Pixmap;
    Mask   : Gdk.Bitmap.Gdk_Bitmap;
    Graphic: Gtk.Pixmap.Gtk_Pixmap;
  begin
    Gdk.Pixmap.Create_From_Xpm_D
      (Pixmap, Gtk.Button.Get_Window (F_Smedit.Current_State_Scroll_Up), Mask,
       Transparent => Gdk.Color.Null_Color,
       Data        => XPMs.Up);
    Gtk.Pixmap.Gtk_New (Graphic, Pixmap, Mask);
    Gtk.Button.Add  (F_Smedit.Current_State_Scroll_Up, Graphic);
    Gtk.Button.Show (F_Smedit.Current_State_Scroll_Up);
  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