Bonjour, Bonjourà tous, Bonjour Hibou, Bonjour Zen, au cas où...
j'ai un problème ce matin avec Gtk.Notebook.
Leur procédure Next_Page, ne fait pas Next_Page dans mon code.
Je travaille sur la nouvelle version d'ultrason. J'étais sur GNU/linux et évidemment sur Windows, c'est pas pareil.
Bref, si quelqu'un veux jeter un Oeil à la procédure Create_Device_Page du projet Gmface :
ici pour Gnu/Linux.
Procédure que j'ai modifié pour Windows :
Source ada :
-------------------------------------------------------------------------------
-- Create device page : (add and remove device(s) --
-------------------------------------------------------------------------------
procedure Create_Device_Page(Notebook : access Gtk_Notebook_Record'Class;
Gtk_Interface : in Gtk_Interface_Pointer;
Device_Num : in positive) is
Vbox : Gtk_Vbox;
Hbox : Gtk_Hbox;
Page_Num : constant Gint := Get_N_Pages(Notebook);
Label : Gtk_Label;
Input_Label : Gtk_Label;
Output_Label : Gtk_Label;
Input_List : constant Devices_List_Access := Inputs_List;
Output_List : constant Devices_List_Access := Outputs_List;
begin
Put_Line("Create page num : " & Gint'Image(Page_Num));
Gtk_New_Vbox (Vbox, False, 0);
Gtk_New(Label, "Device Id :" & Gint'Image(Page_Num+1));
if Gtk_Interface.Gm_Application.Devices_Info(Device_Num) = null then
Gtk_Interface.Gm_Application.Devices_Info(Device_Num) := new Device_Record;
end if;
Gtk_Interface.Devices_Pages(Positive(Page_Num+1)) := new Device_Page_Record;
Gtk.Combo_Box_text.Gtk_New(Gtk_Interface.Devices_Pages(Positive(Page_Num+1)).Input_Device);
--
for Input in Input_List'Range loop
if Input_List(Input).Name /= null then
Gtk.Combo_Box_text.Append_Text
(Gtk_Interface.Devices_Pages(Positive(Page_Num+1)).Input_Device,
Input_List(Input).Name.all);
end if;
end loop;
if Inputs_Devices(Device_Num) /= (-1) then
Gtk.Combo_Box_text.Set_Active
(Gtk_Interface.Devices_Pages(Positive(Page_Num+1)).Input_Device,
Gint(Inputs_Devices(Device_Num)));
end if;
Devices_User_Callback.Connect
(Gtk_Interface.Devices_Pages(Positive(Page_Num+1)).Input_Device,
"changed",
Devices_User_Callback.To_Marshaller(Set_Input_Device'Access),
Gtk_Interface);
Gtk.Combo_Box_text.Gtk_New(Gtk_Interface.Devices_Pages(Positive(Page_Num+1)).Output_Device);
--
for Output in Output_List'Range loop
if Output_List(Output).Name /= null then
Gtk.Combo_Box_Text.Append_Text
(Gtk_Interface.Devices_Pages(Positive(Page_Num+1)).Output_Device,
Output_List(Output).Name.all);
end if;
end loop;
if Outputs_Devices(Device_Num) /= (-1) then
Gtk.Combo_Box_text.Set_Active
(Gtk_Interface.Devices_Pages(Positive(Page_Num+1)).Output_Device,
Gint(Outputs_Devices(Device_Num)));
end if;
Devices_User_Callback.Connect
(Gtk_Interface.Devices_Pages(Positive(Page_Num+1)).Output_Device,
"changed",
Devices_User_Callback.To_Marshaller(Set_Output_Device'Access),
Gtk_Interface);
Gtk_New(Input_Label, "Input : ");
Gtk_New(Output_Label, "Output : ");
Gtk_New_Hbox(Hbox, False, 0);
Pack_Start(Hbox, Input_Label);
Pack_Start(Hbox, Gtk_Interface.Devices_Pages(Positive(Page_Num+1)).Input_Device);
Pack_Start(Vbox, Hbox);
Gtk_New_Hbox(Hbox, False, 0);
Pack_Start(Hbox, Output_Label);
Pack_Start(Hbox, Gtk_Interface.Devices_Pages(Positive(Page_Num+1)).Output_Device);
Pack_Start(Vbox, Hbox);
Append_Page (Notebook, Vbox, Label);
Show_All(Notebook);
-- for I in Gint(Gtk_Interface.Cur_Page) .. Page_Num + 1 loop
-- Next_Page(Notebook);
-- end loop;
Gtk_Interface.Cur_Page := Integer(Get_N_Pages(Notebook)-1);
Put_Line("Cur_Page : " & Integer'Image(Gtk_Interface.Cur_Page));
end Create_Device_Page;
Bon, c'est du taf, je vous serai reconnaissant.
Merci.