Deutsch   English   Français   Italiano  
<ba295165-4f5f-46da-aa73-dc8fddc0703bn@googlegroups.com>

View for Bookmarking (what is this?)
Look up another Usenet article

X-Received: by 2002:a05:620a:14b1:: with SMTP id x17mr7879506qkj.37.1631834449701;
        Thu, 16 Sep 2021 16:20:49 -0700 (PDT)
X-Received: by 2002:a9d:4916:: with SMTP id e22mr7120471otf.43.1631834449449;
 Thu, 16 Sep 2021 16:20:49 -0700 (PDT)
Path: ...!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: fr.comp.lang.ada
Date: Thu, 16 Sep 2021 16:20:49 -0700 (PDT)
In-Reply-To: <shv0d7$1sv$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=102.142.26.141; posting-account=rdYO6wkAAAAd45iu4u7Y67MQUwG0Eumn
NNTP-Posting-Host: 102.142.26.141
References: <e0c35ed1-c15f-419f-a724-07a3c3bf5d2an@googlegroups.com> <shv0d7$1sv$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ba295165-4f5f-46da-aa73-dc8fddc0703bn@googlegroups.com>
Subject: Re: Les Callback en Ada
From: Danielle Mandi Mayagha <dmandimayagha@gmail.com>
Injection-Date: Thu, 16 Sep 2021 23:20:49 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 70
Bytes: 3606

Le jeudi 16 septembre 2021 =C3=A0 09:48:41 UTC+1, J-P. Rosen a =C3=A9crit=
=C2=A0:
> Le 16/09/2021 =C3=A0 04:29, Danielle Mandi Mayagha a =C3=A9crit :=20
> > Salut Salut Je viens avec un tout petit (un gros enfaite) probl=C3=A8me=
 qui me sauf un peu le cerveau. bon voila! j'essaie de faire un Callback av=
ec un Bouton mais le souci c'est que ce bon vieux Gnat me dit ceci ( pour i=
nfo je suis carr=C3=A9ment nul en anglais=F0=9F=98=8A=F0=9F=98=9B) :=20
> > Instantiation error at gtk-handlers.ads : 1039=20
> > Subprogram must not be deeper than access type.=20
> >
> [...]
> > voici mon code :=20
> >=20
> > WITH Gtk.Main; USE Gtk.Main;=20
> > WITH Gtk.Widget; USE Gtk.Widget;=20
> > WITH Gtk.Window; USE Gtk.Window;=20
> > WITH Gtk.Enums; USE Gtk.Enums;=20
> > WITH Gtk.Button; USE Gtk.Button;=20
> > WITH Gtk.Handlers;=20
> >=20
> > Procedure Test is=20
> >=20
> > Package P_Callback is new Gtk.Handlers.Callback (Gtk_Widget_Record);=20
> > USE P_Callback;=20
> >=20
> > Procedure Stop_Program ( Emetteur : Gtk_Widget_Record'Class ) is=20
> > Pragma Unreferenced (Emetteur);=20
> > begin=20
> > Main_Quit;=20
> >=20
> > end Stop_Program;
> Ici, Stop_Program est un sous-programme interne =C3=A0 la proc=C3=A9dure =
Test
> >=20
> > Win : Gtk_Window;=20
> > Bouton : Gtk_Button;=20
> >=20
> > begin=20
> > Init;=20
> >=20
> > Gtk_New (Win);=20
> > Win.Set_Default_Size (600,400);=20
> >=20
> > Gtk_New (Bouton,"Le Bouton");=20
> >=20
> >=20
> > Win.Add (Bouton);=20
> >=20
> > P_Callback.Connect (Bouton,"Clicked", To_marshaller (Stop_Program'Acces=
s));
> Le type attendu par To_Marshaller est un pointeur global. On ne peut lui=
=20
> passer un sous-programme local, car il y aurait un risque de pouvoir=20
> acc=C3=A9der au sous-programme apr=C3=A8s =C3=AAtre sorti de sa port=C3=
=A9e.=20
>=20
> Le plus simple: sors Stop_Program de Test en le mettant dans un fichier=
=20
> s=C3=A9par=C3=A9. (bien s=C3=BBr, pour pouvoir y acc=C3=A9der, Test devra=
 faire un "with=20
> Stop_Program;")=20
>=20
>=20
> --=20
> J-P. Rosen=20
> Adalog=20
> 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX=20
> Tel: +33 1 45 29 21 52=20
> https://www.adalog.fr

merci beaucoup =C3=A7a fonctionne tres bien maintenant