Deutsch   English   Français   Italiano  
<v9gfo7$1rq4$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feeds.phibee-telecom.net!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Newsgroups: comp.lang.ada
Subject: Re: On_Button_Press_Event in Text_View
Date: Tue, 13 Aug 2024 22:29:59 +0200
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <v9gfo7$1rq4$1@dont-email.me>
References: <v9fgh4$3s34v$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 13 Aug 2024 22:29:59 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="e5678bb8536d749e67499a9a73bd079f";
	logging-data="61252"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/6Adryx3NcVJ2QXMLoA51Za6aRlNDSmC4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:uR/QZCyHQ9wRMNX3IxMK2YZ4xDI=
In-Reply-To: <v9fgh4$3s34v$1@dont-email.me>
Content-Language: en-US
Bytes: 2249

On 2024-08-13 13:37, Gavin McCord wrote:

> I have a custom handler used when I update the Text_Buffer:
> 
>   Button_Callback.Connect
>     (Update_Button, "clicked", Update_Clicked'Access,
>      Buffer_To_Pass);
> 
> That works fine so I was imagining something similar might
> be possible, but I've run through various permuations of
> records and access types but not yet got a working callback.
> 
> Any help gratefully received (I can post the full code if
> that's useful).

Something like this:

    package Event_Handlers is
       new Gtk.Handlers.User_Return_Callback
           (  GObject_Record,
              Boolean,
              User_Data_Type
           );


    function On_Button_Press
             (  Object : access GObject_Record'Class;
                Event  : Gdk_Event;
                Data   : User_Data_Type
             )  return Boolean;


    View.Set_Events (View.Get_Events or Button_Press_Mask);
    Event_Handlers.Connect
    (  View,
       "button-press-event",
       Event_Handlers.To_Marshaller (On_Button_Press'Access),
       Data
    );

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de