From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Gtkada: attach signals to menus
Date: Sat, 18 Jun 2016 20:07:48 +0200
Date: 2016-06-18T20:07:48+02:00 [thread overview]
Message-ID: <nk42lv$h29$1@gioia.aioe.org> (raw)
In-Reply-To: adc9838a-a454-46ab-ae39-20f9f306c168@googlegroups.com
On 2016-06-18 19:05, Stephen Leake wrote:
> I'm using GNAT 2016 GtkAda. I'm trying to set a menu signal handler
> in code, but the signal handler is not called.
Great! I missed notification that it is out. (I hope that it is not too
much GtkAda code is broken since GtkAda GPL 2015)
> pragma License (GPL);
>
> with Ada.Text_IO;
> with Gtk.Main;
> with Gtk.Menu;
> with Gtk.Menu_Bar;
> with Gtk.Menu_Item;
> with Gtk.Menu_Shell;
> with Gtk.Widget;
> package body Menu_Demo_Pkg is
>
> procedure On_Window_Destroy (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)
> is
> pragma Unreferenced (Widget);
> begin
> Gtk.Main.Main_Quit;
> end On_Window_Destroy;
>
> procedure On_File_Menu_Activate
> (Self : access Gtk.Menu_Shell.Gtk_Menu_Shell_Record'Class;
> Force_Hide : Boolean)
> is
> pragma Unreferenced (Force_Hide);
> pragma Unreferenced (Self);
> begin
> Ada.Text_IO.Put_Line ("On_File_Menu_Activate");
> end On_File_Menu_Activate;
>
> procedure On_Menu_Activate
> (Self : access Gtk.Menu_Shell.Gtk_Menu_Shell_Record'Class;
> Force_Hide : Boolean)
> is
> pragma Unreferenced (Force_Hide);
> pragma Unreferenced (Self);
> begin
> Ada.Text_IO.Put_Line ("On_Menu_Activate");
> end On_Menu_Activate;
>
> function Gtk_New return Gtk.Window.Gtk_Window
> is
> use Gtk.Menu;
> use Gtk.Menu_Item;
>
> Main_Window : constant Gtk.Window.Gtk_Window := Gtk.Window.Gtk_Window_New;
> Menu_Bar : constant Gtk.Menu_Bar.Gtk_Menu_Bar := Gtk.Menu_Bar.Gtk_Menu_Bar_New;
> Menu : constant Gtk_Menu := Gtk_Menu_New;
> Item : Gtk_Menu_Item;
>
> begin
> Main_Window.On_Destroy (On_Window_Destroy'Access);
>
> Menu.Append (Gtk_Menu_Item_New_With_Mnemonic ("_Quit"));
> Item := Gtk_Menu_Item_New_With_Mnemonic ("_File");
> Item.Set_Submenu (Menu);
Why not this:
Item.On_Activate (...); -- Called when File is activated
> When I run menu_demo, a window shows, with a menu. But when I select the menu item, no text is displayed.
>
> How do I make this work?
I believe "activate-current" is not a notification signal, rather a
signal emitted in order to activate the menu item.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2016-06-18 18:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-18 17:05 Gtkada: attach signals to menus Stephen Leake
2016-06-18 18:07 ` Dmitry A. Kazakov [this message]
2016-06-18 18:21 ` Stephen Leake
2016-06-19 15:02 ` Stephen Leake
2016-06-19 18:33 ` Dmitry A. Kazakov
2016-06-20 9:18 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox