From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.3d73Ybk3C5U4I2t8lv+lAQ.user.gioia.aioe.org!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: How to write gpr files from scratch , example 1, build only one package Date: Sat, 2 Nov 2019 09:42:30 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <451888fd-9b13-4a8c-b7cf-111f877efcde@googlegroups.com> <5f16f17b-d9b4-4f55-ae26-2d8464c96926@googlegroups.com> NNTP-Posting-Host: 3d73Ybk3C5U4I2t8lv+lAQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:57438 Date: 2019-11-02T09:42:30+01:00 List-Id: On 2019-11-01 23:10, Alain De Vos wrote: > On Friday, November 1, 2019 at 11:04:07 PM UTC+1, Alain De Vos wrote: >> https://docs.adacore.com/gprbuild-docs/html/gprbuild_ug/gnat_project_manager.html >> >> I have a file buttonhandler.adb containing : >> -- TEST : Connecting via the On_* procedures first method >> with GTk...stuff...; >> package body buttonhandler is >> procedure On_Button_Click (Button : access Gtk_Button_Record'Class) is >> begin >> Put_line ("Hallo"); >> end On_Button_Click; >> end buttonhandler; Apart from not having the package specification. Text_IO is not the way to do it. A GTK application may have no standard output at all, e.g. under Windows you will see nothing. Add a container Gtk_Grid or Gtk_Box to the top-level window. Put a Gtk_Button and a Gtk_Label there. Use Set_Text on the label from the button click callback. You will see another problem immediately. The standard callback operations are useless most of the time because you need other parameters, like the container or the label. See the package Gtk.Handlers how to create handlers with parameters, e.g. User_Callback in there. For example: package Button_Handlers is new Gtk.Handlers.User_Callback (Gtk_Button_Record, Gtk_Label); Then procedure On_Button_Click ( Button : access Gtk_Button_Record'Class; Label : Gtk_Label ) is begin Label.Set_Text ("Hallo"); end On_Button_Click; Connecting to the signal goes as follows: Button_Handlers.Connect ( Button, "clicked", On_Button_Click'Access, Label ); -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de