comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: GtkAda Buttons
Date: Tue, 24 Aug 2021 17:03:28 +0200	[thread overview]
Message-ID: <sg31nv$q3m$1@gioia.aioe.org> (raw)
In-Reply-To: a8abb9c1-0b52-4d08-bade-d74b2a65114bn@googlegroups.com

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

      reply	other threads:[~2021-08-24 15:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 14:36 GtkAda Buttons AdaMagica
2021-08-24 15:03 ` Dmitry A. Kazakov [this message]
replies disabled

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