Bonjour,

Voici mon code avec Ada.

Les paquets handlers.
Code ada : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
 type Gtk_File_Selection_Access is access all Gtk_File_Selection;
   package Destroy_Cb is new Gtk.Handlers.User_Callback
     (Gtk_File_Selection_Record, Gtk_File_Selection_Access);
   package Files_Cb is new Gtk.Handlers.User_Callback
     (Gtk_File_Selection_Record, Object_Pointer);

Ma procédure d'appel.
Code ada : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
File_Selection : aliased Gtk_File_Selection;
   procedure Open_Bank(Action, Hmi : System.Address) is
 
   begin
      Gtk_New (File_Selection, Title => "File Selection Dialog");
      Destroy_Cb.Connect
	(File_Selection, "destroy", Destroy_Cb.To_Marshaller (Destroyed'Access), File_Selection'access);
      Files_Cb.Object_Connect (Get_Ok_Button (File_Selection), "clicked", Files_Cb.To_Marshaller (Open_Bank_Ok'Access),
			       File_Selection,
			       To_Pointer(Hmi));
      Destroy_Cb.Object_Connect
	(Get_Cancel_Button (File_Selection), "clicked",
	 Destroy_Cb.To_Marshaller (destroyed'Access),
	 File_Selection,
	 File_Selection'access);
      Show (File_Selection);
   end Open_Bank;

Quand le bouton Ok est selectionné.
Code ada : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
--------
   -- Ok --
   --------
 
   procedure Open_Bank_OK (File_Selection : access Gtk_File_Selection_Record'Class;
			   Hmi : in Object_Pointer) is
 
   begin
      declare
	 Filename : String := Get_Filename(File_Selection);
      begin
	 if Filename /= "" then
	    Hmi.Bank := new Bank_Type ' (Initialize_From_File(filename));
	 end if;
      end;
      Destroy (File_Selection);
   end Open_Bank_OK;

J'ai copié le create_file_selection de test gtk.