* How to write gpr files from scratch , example 1, build only one package
@ 2019-11-01 22:04 Alain De Vos
2019-11-01 22:10 ` Alain De Vos
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Alain De Vos @ 2019-11-01 22:04 UTC (permalink / raw)
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;
--------------------------------------------
> Now I write : my_buttonhandler.gpr contents (as there is no main entry),
with "gtkada.gpr";
project My_buttonhandler is
end My_buttonhandler;
------------------------------------------
Executing :
gprbuild -Pmy_buttonhandler.gpr returns :
Compile
[Ada] buttonhandler.adb
buttonhandler.adb:19:14: file "buttonhandler.ads" not found
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to write gpr files from scratch , example 1, build only one package
2019-11-01 22:04 How to write gpr files from scratch , example 1, build only one package Alain De Vos
@ 2019-11-01 22:10 ` Alain De Vos
2019-11-02 8:42 ` Dmitry A. Kazakov
2019-11-01 22:26 ` Simon Wright
2019-11-02 10:13 ` Alain De Vos
2 siblings, 1 reply; 9+ messages in thread
From: Alain De Vos @ 2019-11-01 22:10 UTC (permalink / raw)
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;
> --------------------------------------------
> > Now I write : my_buttonhandler.gpr contents (as there is no main entry),
> with "gtkada.gpr";
> project My_buttonhandler is
> end My_buttonhandler;
> ------------------------------------------
> Executing :
> gprbuild -Pmy_buttonhandler.gpr returns :
> Compile
> [Ada] buttonhandler.adb
> buttonhandler.adb:19:14: file "buttonhandler.ads" not found
In C language you just compile all the object files and link them together but here it is bit different ...
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to write gpr files from scratch , example 1, build only one package
2019-11-01 22:04 How to write gpr files from scratch , example 1, build only one package Alain De Vos
2019-11-01 22:10 ` Alain De Vos
@ 2019-11-01 22:26 ` Simon Wright
2019-11-01 22:33 ` Alain De Vos
2019-11-02 10:13 ` Alain De Vos
2 siblings, 1 reply; 9+ messages in thread
From: Simon Wright @ 2019-11-01 22:26 UTC (permalink / raw)
Alain De Vos <devosalain71@gmail.com> writes:
> buttonhandler.adb:19:14: file "buttonhandler.ads" not found
Perhaps the reason for the compiler not finding this file is that you
haven't written it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to write gpr files from scratch , example 1, build only one package
2019-11-01 22:26 ` Simon Wright
@ 2019-11-01 22:33 ` Alain De Vos
2019-11-01 22:34 ` Alain De Vos
2019-11-01 22:50 ` Dennis Lee Bieber
0 siblings, 2 replies; 9+ messages in thread
From: Alain De Vos @ 2019-11-01 22:33 UTC (permalink / raw)
On Friday, November 1, 2019 at 11:26:13 PM UTC+1, Simon Wright wrote:
> Alain De Vos <devosalain71@gmail.com> writes:
>
> > buttonhandler.adb:19:14: file "buttonhandler.ads" not found
>
> Perhaps the reason for the compiler not finding this file is that you
> haven't written it.
The line 19 is :
package body buttonhandler is
Maybe i missed something ?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to write gpr files from scratch , example 1, build only one package
2019-11-01 22:33 ` Alain De Vos
@ 2019-11-01 22:34 ` Alain De Vos
2019-11-01 23:05 ` Alain De Vos
2019-11-01 22:50 ` Dennis Lee Bieber
1 sibling, 1 reply; 9+ messages in thread
From: Alain De Vos @ 2019-11-01 22:34 UTC (permalink / raw)
On Friday, November 1, 2019 at 11:33:24 PM UTC+1, Alain De Vos wrote:
> On Friday, November 1, 2019 at 11:26:13 PM UTC+1, Simon Wright wrote:
> > Alain De Vos <devosalain71@gmail.com> writes:
> >
> > > buttonhandler.adb:19:14: file "buttonhandler.ads" not found
> >
> > Perhaps the reason for the compiler not finding this file is that you
> > haven't written it.
>
> The line 19 is :
> package body buttonhandler is
>
> Maybe i missed something ?
give me a minute :)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to write gpr files from scratch , example 1, build only one package
2019-11-01 22:33 ` Alain De Vos
2019-11-01 22:34 ` Alain De Vos
@ 2019-11-01 22:50 ` Dennis Lee Bieber
1 sibling, 0 replies; 9+ messages in thread
From: Dennis Lee Bieber @ 2019-11-01 22:50 UTC (permalink / raw)
On Fri, 1 Nov 2019 15:33:22 -0700 (PDT), Alain De Vos
<devosalain71@gmail.com> declaimed the following:
>On Friday, November 1, 2019 at 11:26:13 PM UTC+1, Simon Wright wrote:
>> Alain De Vos <devosalain71@gmail.com> writes:
>>
>> > buttonhandler.adb:19:14: file "buttonhandler.ads" not found
>>
>> Perhaps the reason for the compiler not finding this file is that you
>> haven't written it.
>
>The line 19 is :
>package body buttonhandler is
>
>Maybe i missed something ?
That defines a BODY file. It is not a SPECification file (.ads).
The spec file defines the interface -- what objects and methods are
available to users of the package.
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to write gpr files from scratch , example 1, build only one package
2019-11-01 22:34 ` Alain De Vos
@ 2019-11-01 23:05 ` Alain De Vos
0 siblings, 0 replies; 9+ messages in thread
From: Alain De Vos @ 2019-11-01 23:05 UTC (permalink / raw)
On Friday, November 1, 2019 at 11:34:27 PM UTC+1, Alain De Vos wrote:
> On Friday, November 1, 2019 at 11:33:24 PM UTC+1, Alain De Vos wrote:
> > On Friday, November 1, 2019 at 11:26:13 PM UTC+1, Simon Wright wrote:
> > > Alain De Vos <devosalain71@gmail.com> writes:
> > >
> > > > buttonhandler.adb:19:14: file "buttonhandler.ads" not found
> > >
> > > Perhaps the reason for the compiler not finding this file is that you
> > > haven't written it.
> >
> > The line 19 is :
> > package body buttonhandler is
> >
> > Maybe i missed something ?
>
> give me a minute :)
Writing an ads files solved the problem.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to write gpr files from scratch , example 1, build only one package
2019-11-01 22:10 ` Alain De Vos
@ 2019-11-02 8:42 ` Dmitry A. Kazakov
0 siblings, 0 replies; 9+ messages in thread
From: Dmitry A. Kazakov @ 2019-11-02 8:42 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to write gpr files from scratch , example 1, build only one package
2019-11-01 22:04 How to write gpr files from scratch , example 1, build only one package Alain De Vos
2019-11-01 22:10 ` Alain De Vos
2019-11-01 22:26 ` Simon Wright
@ 2019-11-02 10:13 ` Alain De Vos
2 siblings, 0 replies; 9+ messages in thread
From: Alain De Vos @ 2019-11-02 10:13 UTC (permalink / raw)
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;
> --------------------------------------------
> > Now I write : my_buttonhandler.gpr contents (as there is no main entry),
> with "gtkada.gpr";
> project My_buttonhandler is
> end My_buttonhandler;
> ------------------------------------------
> Executing :
> gprbuild -Pmy_buttonhandler.gpr returns :
> Compile
> [Ada] buttonhandler.adb
> buttonhandler.adb:19:14: file "buttonhandler.ads" not found
Yes gtk.handlers are the way to go, but one step at a time, I come that later.
I order not not clutter I post a new specific question regarding the on_procedure method.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-11-02 10:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-01 22:04 How to write gpr files from scratch , example 1, build only one package Alain De Vos
2019-11-01 22:10 ` Alain De Vos
2019-11-02 8:42 ` Dmitry A. Kazakov
2019-11-01 22:26 ` Simon Wright
2019-11-01 22:33 ` Alain De Vos
2019-11-01 22:34 ` Alain De Vos
2019-11-01 23:05 ` Alain De Vos
2019-11-01 22:50 ` Dennis Lee Bieber
2019-11-02 10:13 ` Alain De Vos
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox