From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!Hx95GBhnJb0Xc8StPhH8AA.user.46.165.242.91.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: GtkAda Buttons Date: Tue, 24 Aug 2021 17:03:28 +0200 Organization: Aioe.org NNTP Server Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: gioia.aioe.org; logging-data="26742"; posting-host="Hx95GBhnJb0Xc8StPhH8AA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader02.eternal-september.org comp.lang.ada:62538 List-Id: On 2021-08-24 16:36, AdaMagica wrote: > GtkAda is a big mess. Yep. > There is no real documentation. Neither the GtkAda_UG nor the GtkAda_RM are a real help. They are automatically generated. It is usually better to look the original GTK documentation. It is not bad just incredibly complicated to find what you are looking for and understand how it works. My method: 1. Search the GtkAda body. It will be like this: procedure Set_Action_Name (Self : not null access Gtk_Color_Button_Record; Action_Name : UTF8_String) is procedure Internal (Self : System.Address; Action_Name : Gtkada.Types.Chars_Ptr); pragma Import (C, Internal, "gtk_actionable_set_action_name"); Tmp_Action_Name : Gtkada.Types.Chars_Ptr := New_String (Action_Name); begin Internal (Get_Object (Self), Tmp_Action_Name); Free (Tmp_Action_Name); end Set_Action_Name; [ AdaCore, why do not you use a local C string on the stack? It is freed anyway! ] 2. Look for gtk_actionable_set_action_name This is your starting point since the thing is an "interface" like Ada's interface. 3. Look which widgets implement the interface. 4. If nothing helps, look in the GTK sources. They are not bad for a C library. > My present problem: > > What is the use of > procedure Set_Action_Name > (Self : not null access Gtk_Button_Record; > Action_Name : UTF8_String); https://developer-old.gnome.org/gtk3/stable/GtkActionable.html > I am unable to find a documentation of this procedure. If I call it for a button, the callback does no longer work. > > Gtk.Button.Gtk_New (XXX, Name); > Gtk.Button.Set_Action_Name (XXX, "yyy"); The button must have an appropriate parent to activate the action on it, e.g. https://developer-old.gnome.org/gtk3/stable/GtkApplicationWindow.html The action name must be registered, known to the parent, it cannot be any "yyy" and there could be a parameter necessary for pass for the action. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de