From: Alain De Vos <devosalain71@gmail.com>
Subject: Re: gtkada evenhandler on_procedure method , how to access children of topwindow in the eventhandler
Date: Sat, 2 Nov 2019 04:00:28 -0700 (PDT)
Date: 2019-11-02T04:00:28-07:00 [thread overview]
Message-ID: <5223dc8d-2023-431c-b9c6-f122492e82d7@googlegroups.com> (raw)
In-Reply-To: <cf3be50e-637f-4db3-b0a2-ed5d251af8b5@googlegroups.com>
On Saturday, November 2, 2019 at 11:22:49 AM UTC+1, Alain De Vos wrote:
> I have a window with obe button and one label and want to change the text on the label when the button is pressed in the eventhandler, I pass the top window.
>
> procedure hello is
> Top : Gtk.Window.Gtk_Window;
> Button : Gtk_Button;
> Label : Gtk_Label;
> VBox : Gtk_Box;
> procedure Create_Window is
> begin
> Gtk.Window.Gtk_New
> (Window => Top,
> The_Type => Gtk.Enums.Window_Toplevel);
> Gtk.Window.Set_Title (Window => Top, Title => "Hello from ADA");
> Gtk_New(Button);
> Button.On_Clicked (Call => On_Button_Click'Access,
> Slot => Top);
> Gtk_New(Label);
> Gtk_New_Vbox(VBox);
> Add (VBox,Button);
> Add (VBox,Label);
> Add (Top,VBox);
> Gtk.Window.Show_All (Top);
> end Create_Window;
> begin
> Gtk.Main.Init;
> Create_Window;
> Gtk.Main.Main;
> end hello;
>
> I pass the topwindow to the eventhandler(slot).
> In the eventhandler I need go from the Top to the Vbox to the Label and set the text on the label ... button pressed. I probably need to set a property in the main and query it in the handler and cast the correct type ...
> {The label is not directly visible in the handler ...}
>
> package body buttonhandler is
> procedure On_Button_Click (Top : access Glib.Object.GObject_Record'Class) is
> begin
> Put_line ("Hallo");
> -- I need to go from Top to Vbox to Label and set text ... ????
> end On_Button_Click;
> end buttonhandler;
Or should I subclass Gtk.Window.Gtk_Window ?
next prev parent reply other threads:[~2019-11-02 11:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-02 10:22 gtkada evenhandler on_procedure method , how to access children of topwindow in the eventhandler Alain De Vos
2019-11-02 11:00 ` Alain De Vos [this message]
2019-11-02 11:03 ` Dmitry A. Kazakov
2019-11-02 15:27 ` Alain De Vos
2019-11-02 16:18 ` Dmitry A. Kazakov
2019-11-02 19:07 ` Alain De Vos
2019-11-02 19:21 ` Dmitry A. Kazakov
2019-11-02 22:03 ` Alain De Vos
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox