From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Gtkada: attach signals to menus Date: Sat, 18 Jun 2016 20:07:48 +0200 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: w/2xSGckQeJEFvqsQFNodA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:30791 Date: 2016-06-18T20:07:48+02:00 List-Id: 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