0

我正在使用 Gtkada 在 Ada 中开发 HMI,我想创建一个垂直分隔符 (Gtk_Vseparator),但它没有被显示。我把它放在一个对齐中,当我在对齐中添加一个按钮时,它会出现,但是当我添加分隔符时它没有,我不知道为什么。

这是我的代码:

   Win                  : Gtk_Window;
   Notebook             : Gtk_Notebook;
   Notebook_Label       : Gtk_Label;
   Box_0                : Gtk_Vbox;
   Alignment_1          : Gtk_Alignment;
   Generate_Button      : Gtk_Button;
   Box_1                : Gtk_Hbox;
   Box_2_Add            : Gtk_Vbox;
   Alignment_2          : Gtk_Alignment;
   Add_Delete_Separator : Gtk_Vseparator;
   Box_2_Delete         : Gtk_Vbox;

   Init;
   Gtk_New (Win, Window_Toplevel);
   Gtk_New (Notebook);
   Gtk_New (Notebook_Label, "Generation");
   Gtk_New_Vbox (Box_0, Homogeneous => False, Spacing => 20);
   Gtk_New (Alignment_1, 0.5, 0.5, 0.0, 0.0);
   Gtk_New (Generate_Button, "Generate model");
   Gtk_New_Hbox (Box_1, Homogeneous => False);
   Gtk_New_Vbox (Box_2_Add, Homogeneous => False);
   Gtk_New (Alignment_2, 0.5, 0.5, 0.0, 0.0);
   Gtk_New_Vseparator (Add_Delete_Separator);
   Gtk_New_Vbox (Box_2_Delete, Homogeneous => False);

   Add_Delete_Separator.Show;
   Alignment_2.Add (Add_Delete_Separator);
   Box_1.Pack_End (Box_2_Add, Expand => True, Fill => True);
   Box_1.Pack_End (Alignment_2, Expand => True, Fill => True);
   Box_1.Pack_End (Box_2_Delete, Expand => True, Fill => True);
   Alignment_1.Add (Generate_Button);
   Box_0.Pack_End (Box_1, Expand => True, Fill => True);
   Box_0.Pack_End (Alignment_1, Expand => False, Fill => True); 

   Notebook.Append_Page (Box_0, Notebook_Label);
   Win.Set_Title ("Generator");
   Win.Set_Default_Size (1200, 800);
   Win.Set_Position (Win_Pos_Center);
   Win.Add (Notebook);
   Win.Show_All;

   Main;
4

1 回答 1

2

AVseparator没有所需的最小高度。因此,您需要告诉对齐放置它的位置,它应该使用所有可用的垂直空间:

Gtk_New (Alignment_2, 0.5, 0.5, 0.0, 1.0);

顺便说一句,请将您的代码发布为SSCCE。剥离begin等不会使代码更具可读性。

于 2013-08-31T07:28:06.467 回答