comp.lang.ada
 help / color / mirror / Atom feed
From: Gavin McCord <gavind.mccord@gmail.com>
Subject: Re: Errors using gtk.font_button in gtkada (gtk3)
Date: Wed, 13 Feb 2019 21:26:03 -0000 (UTC)
Date: 2019-02-13T21:26:03+00:00	[thread overview]
Message-ID: <q4221b$j54$1@dont-email.me> (raw)
In-Reply-To: q3t1ds$1ivc$1@gioia.aioe.org


No, that makes sense, but I must be missing something
really obvious. I've simplified the code so there's
only a button, a label and the font_button, with one
main program file and a callback package (see below),
though the font_button isn't even connected to a
handler at this point, the error still occurs when
it's clicked on.



test2.adb
---------
with Gtk.Main;
with Gtk.Window;        use Gtk.Window;
with Gtk.Box;           use Gtk.Box;
with Gtk.Widget;        use Gtk.Widget;
with Gtk.Button;        use Gtk.Button;
with Gtk.Font_Button;   use Gtk.Font_Button;
with Gtk.Label;         use Gtk.Label;
with Gtkada.Handlers;   use Gtkada.Handlers;
with Test2_Cb;          use Test2_Cb;


procedure Test2 is

   Win          : Gtk_Window;
   Vert_Box     : Gtk_VBox;
   Button       : Gtk_Button;
   FontButton   : Gtk_Font_Button;
   Label        : Gtk_Label;

   begin

      Gtk.Main.Init;
      Gtk_New (Win);
      Win.Set_Default_Size (480, 160);
      Win.Set_Title ("FontButton test");
      Win.On_Destroy (Main_Quit'Access);
      Gtk_New_VBox (Vert_Box, False, 0);
      Win.Add (Vert_Box);
      Gtk_New (Label, "A label.");
      Pack_Start (Vert_Box, Label, True, False, 0);
      Gtk_New (FontButton);
      Pack_Start (Vert_Box, FontButton, True, False, 0);
      Gtk_New (Button, "Quit");
      Widget_Callback.Object_Connect
        (Button, "clicked",
         Widget_Callback.To_Marshaller (Button_Quit'Access),
         Win);
      Pack_Start (Vert_Box, Button, True, False, 0);
      Win.Show_All;
      Gtk.Main.Main;

end Test2;
----------


test2_cb.adb
------------
package body Test2_Cb is

   procedure Main_Quit (Self : access Gtk_Widget_Record'Class) is
   begin
      Gtk.Main.Main_Quit;
   end Main_Quit;

   procedure Button_Quit (Self : access Gtk_Widget_Record'Class) is
   begin
      Destroy (Self);
   end Button_Quit;

end Test2_Cb;
-------------


test2_cb.ads
------------
with Gtk.Main;
with Gtk.Widget;   use Gtk.Widget;

package Test2_Cb is

   procedure Main_Quit   (Self : access Gtk_Widget_Record'Class);
   procedure Button_Quit (Self : access Gtk_Widget_Record'Class);

end Test2_Cb;
-------------

  reply	other threads:[~2019-02-13 21:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11 23:04 Errors using gtk.font_button in gtkada (gtk3) Gavin McCord
2019-02-11 23:45 ` Dmitry A. Kazakov
2019-02-13 21:26   ` Gavin McCord [this message]
2019-02-13 22:02     ` Dmitry A. Kazakov
2019-02-13 23:22       ` Gavin McCord
2019-02-13 23:42         ` Gavin McCord
2019-02-14  8:26           ` Dmitry A. Kazakov
2019-02-14 23:31             ` Gavin McCord
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox