Les Callback en Ada

Liste des GroupesRevenir à fcl ada 
Sujet : Les Callback en Ada
De : dmandimayagha (at) *nospam* gmail.com (Danielle Mandi Mayagha)
Groupes : fr.comp.lang.ada
Date : 16. Sep 2021, 04:29:57
Autres entêtes
Message-ID : <e0c35ed1-c15f-419f-a724-07a3c3bf5d2an@googlegroups.com>
User-Agent : G2/1.0
Salut Salut Je viens avec un tout petit (un gros enfaite) problème  qui me sauf un peu le cerveau. bon voila! j'essaie de faire un Callback avec un Bouton mais le souci c'est que ce bon vieux Gnat me dit ceci ( pour info je suis carrément nul en anglais😊😛) :
  Instantiation error at gtk-handlers.ads : 1039
Subprogram must not be deeper than access type.

plus loin Gnat dit encore ceci :
 No candidate interpretations match the actuals:
expected type "handler" defined at gtk-marshaller.ads :395, instance at gtk-handlers :918 , instance at line 10.
Found type access to procedure "Stop_Program" defined at line 38.
=> in call to "to_marshaller" at gtk-handlers.ads :959, ainstance at line 10
=> in call to "to_marshaller" at gtk-handlers.ads :954, ainstance at line 10
=> in call to "to_marshaller" at gtk-handlers.ads :949, ainstance at line 10
=> in call to "to_marshaller" at gtk-handlers.ads :944, ainstance at line 10
=> in call to "to_marshaller" at gtk-handlers.ads :939, ainstance at line 10
=> in call to "to_marshaller" at gtk-handlers.ads :935, ainstance at line 10
=> in call to "to_marshaller" at gtk-handlers.ads :931, ainstance at line 10
=> in call to "to_marshaller" at gtk-handlers.ads :927, ainstance at line 10
=> in call to "to_marshaller" at gtk-handlers.ads :923, ainstance at line 10

voici mon code :

WITH Gtk.Main;             USE Gtk.Main;
WITH Gtk.Widget;         USE Gtk.Widget;
WITH Gtk.Window;        USE Gtk.Window;
WITH Gtk.Enums;          USE Gtk.Enums;
WITH Gtk.Button;           USE Gtk.Button;
WITH Gtk.Handlers;

Procedure Test is

Package P_Callback is new Gtk.Handlers.Callback (Gtk_Widget_Record);
USE P_Callback;

Procedure Stop_Program ( Emetteur : Gtk_Widget_Record'Class ) is
Pragma Unreferenced (Emetteur);
begin
Main_Quit;

end Stop_Program;

Win : Gtk_Window;
Bouton : Gtk_Button;

begin
Init;

Gtk_New (Win);
Win.Set_Default_Size (600,400);

Gtk_New (Bouton,"Le Bouton");


Win.Add (Bouton);

P_Callback.Connect (Bouton,"Clicked", To_marshaller (Stop_Program'Access));

Win.Show_All;
Main;
end Test;

Voila pour vous dire vrai je ne vois aucun probleme donc si quelqu'un pouvait m'expliquer ce qui cloche j'en serai vraiment ravi.

pour info je suis sur Windows10 et j'utilise la version Gnat 2020.

Date Sujet#  Auteur
16 Sep 21 * Les Callback en Ada8Danielle Mandi Mayagha
16 Sep 21 `* Re: Les Callback en Ada7J-P. Rosen
17 Sep 21  `* Re: Les Callback en Ada6Danielle Mandi Mayagha
20 Sep 21   `* Re: Les Callback en Ada5Danielle Mandi Mayagha
20 Sep 21    +* Re: Les Callback en Ada3DrPi
21 Sep 21    i`* Re: Les Callback en Ada2Danielle Mandi Mayagha
20 Jan 22    i `- Re: Les Callback en Ada1Thomas
21 Sep 21    `- Re: Les Callback en Ada1Ludovic Brenta

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal