| Deutsch English Français Italiano |
|
<v9fgh4$3s34v$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Gavin McCord <gavind.mccord@gmail.com>
Newsgroups: comp.lang.ada
Subject: On_Button_Press_Event in Text_View
Date: Tue, 13 Aug 2024 11:37:09 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <v9fgh4$3s34v$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 13 Aug 2024 13:37:10 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="d4c68536e7045d7f90d0c27d81c453ed";
logging-data="4066463"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18pvZWUmHS234H/h2ulL1wWAJ7o/8TpJctvoL/0ZpM56g=="
User-Agent: Pan/0.149 (Bellevue; 4c157ba git@gitlab.gnome.org:GNOME/pan.git)
Cancel-Lock: sha1:SHKy1jeQ+JQkWR7SwVV+qcJgwMg=
Bytes: 2296
Using gtkada (gtk3), is it possible to use a custom handler to
deal with a button-press-event (or other events if necessary)
inside a widget such as a Text_View?
For example I create a Text_View with buffer. To process a
button-press within that view I have this code in my main
procedure:
The_View.On_Button_Press_Event (Press_CB'Access);
The_View.Set_Events (The_View.Get_Events or Button_Press_Mask);
The callback looks like this:
function Press_CB (Self : access Gtk_Widget_Record'Class;
Event : Gdk_Event_Button)
return Boolean is
begin
Put_Line ("Mouse click in text view");
return True;
end Press_CB;
So far, so good.
But I'd like to pass additional data to the callback,
without using global variables/records if it can be
avoided.
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).
Kind regards,
Gavin McCord