user2563654
user2563654

Reputation:

Tab creation with Gtkada

I'm trying to set up an HMI in Ada with Gtkada and I want to have tabs (Notebooks in the Gtk language).

I didn't found a lot of documentation about Gtkada, here is what I wrote but it doesn't work, do you have an idea why? Only a simple grey window is opening.

with Gtk.Main;      use Gtk.Main;
with Gtk.Window;    use Gtk.Window;
with Gtk.Enums;     use Gtk.Enums;
with Gtk.Notebook;  use Gtk.Notebook;
with Gtk.Button;    use Gtk.Button;
with Gtk.Label;     use Gtk.Label;


procedure IHM is
   Win                          : Gtk_Window;
   Notebook                     : Gtk_Notebook;
   GenerationButton             : Gtk_Button;
   Label_Generation             : Gtk_Label;
begin
   Init;

   Gtk_New (Win, Window_Toplevel);
   Gtk_New (GenerationButton);
   Gtk_New (Notebook);
   Gtk_New (Label_Generation, "Generation");
   Notebook.Append_Page (GenerationButton, Label_Generation);
   Win.Set_Title ("Generator");
   Win.Set_Default_Size (1200, 800);
   Win.Set_Position (Win_Pos_Center);
   Win.Add (Notebook);
   Win.Show;

   Main;
end IHM;

Upvotes: 1

Views: 143

Answers (1)

flyx
flyx

Reputation: 39738

Substitute Win.Show with Win.Show_All. Show is not recursive and will not tell the notebook to show up. Alternatively, you can add Notebook.Show.

Upvotes: 1

Related Questions