comp.lang.ada
 help / color / mirror / Atom feed
* Trying to learn Gtk Ada
@ 2011-07-07 13:15 ldries46
  0 siblings, 0 replies; only message in thread
From: ldries46 @ 2011-07-07 13:15 UTC (permalink / raw)


I am trying to use GtkAda.
At this moment I have created with Glade-2 a dialog with one Label a
Combobox and two buttons.
The program using this dialog compiles without errors.
But when I execute Run(Sphere_Level) I get an empty dialog.

The relevant code is:
      Gtk_New(Sphere_Level);
      if Run(Sphere_Level) = Gtk_Response_OK then
         n3 := Sphere_Level.Levelselection;
      end if;
      Hide(Sphere_Level);
      Destroy(Sphere_Level);

Where the Initialize routine is (created by Glade-2):

procedure Initialize (Sphere_Level : access Sphere_Level_Record'Class) is
   pragma Suppress (All_Checks);
   Pixmaps_Dir : constant String := "pixmaps/";
   Levelselection_Items : String_List.Glist;

begin
   Gtk.Dialog.Initialize (Sphere_Level);
   Set_Title (Sphere_Level, -"Sphere Level");
   Set_Position (Sphere_Level, Win_Pos_None);
   Set_Modal (Sphere_Level, False);
   Set_Resizable (Sphere_Level, True);



   Gtk_New_From_Stock (Sphere_Level.Cancelbutton1, "gtk-cancel");
   Set_Relief (Sphere_Level.Cancelbutton1, Relief_Normal);

   Set_Flags (Sphere_Level.Cancelbutton1, Can_Default);
   Pack_Start (Get_Action_Area (Sphere_Level), Sphere_Level.Cancelbutton1);
   Gtk_New_From_Stock (Sphere_Level.Okbutton1, "gtk-ok");
   Set_Relief (Sphere_Level.Okbutton1, Relief_Normal);

   Set_Flags (Sphere_Level.Okbutton1, Can_Default);
   Pack_Start (Get_Action_Area (Sphere_Level), Sphere_Level.Okbutton1);
   Gtk_New_Hbox (Sphere_Level.Hbox1, False, 0);

   Gtk_New (Sphere_Level.Label1, -("Degree of subdivision" & ASCII.LF & "(1
= basic)"));
   Set_Alignment (Sphere_Level.Label1, 0.5, 0.5);
   Set_Padding (Sphere_Level.Label1, 23, 0);
   Set_Justify (Sphere_Level.Label1, Justify_Left);
   Set_Line_Wrap (Sphere_Level.Label1, False);
   Set_Selectable (Sphere_Level.Label1, False);
   Set_Use_Markup (Sphere_Level.Label1, False);
   Set_Use_Underline (Sphere_Level.Label1, False);

   Pack_Start
     (Sphere_Level.Hbox1,
      Sphere_Level.Label1,
      Expand  => False,
      Fill    => False,
      Padding => 0);
   Gtk_New (Sphere_Level.Levelselection);
   Set_Value_In_List (Sphere_Level.Levelselection, False);
   Set_Use_Arrows (Sphere_Level.Levelselection, True);
   Set_Case_Sensitive (Sphere_Level.Levelselection, False);
   Set_Editable (Get_Entry (Sphere_Level.Levelselection), False);
   Set_Has_Frame (Get_Entry (Sphere_Level.Levelselection), True);
   Set_Max_Length (Get_Entry (Sphere_Level.Levelselection), 2);
   Set_Width_Chars (Get_Entry (Sphere_Level.Levelselection), 2);
   Set_Text (Get_Entry (Sphere_Level.Levelselection), -(""));
   Set_Invisible_Char (Get_Entry (Sphere_Level.Levelselection),
UTF8_Get_Char ("●"));
   Set_Has_Frame (Get_Entry (Sphere_Level.Levelselection), True);
   String_List.Append (Levelselection_Items, -("1"));
   String_List.Append (Levelselection_Items, -("2"));
   String_List.Append (Levelselection_Items, -("3"));
   String_List.Append (Levelselection_Items, -("4"));
   String_List.Append (Levelselection_Items, -("5"));
   String_List.Append (Levelselection_Items, -("6"));
   String_List.Append (Levelselection_Items, -("7"));
   String_List.Append (Levelselection_Items, -("8"));
   String_List.Append (Levelselection_Items, -("9"));
   Combo.Set_Popdown_Strings (Sphere_Level.Levelselection,
Levelselection_Items);
   Free_String_List (Levelselection_Items);


   Pack_Start
     (Sphere_Level.Hbox1,
      Sphere_Level.Levelselection,
      Expand  => True,
      Fill    => True,
      Padding => 0);
   Pack_Start
     (Get_Vbox (Sphere_Level),
      Sphere_Level.Hbox1,
      Expand  => True,
      Fill    => True,
      Padding => 0);

   --  Connect signals

end Initialize;

I am convinced that I forget something but I tried to find anything to learn
from on the internet, but I cannot find anything.
You can help me by explaning what I forgot or by sending a link where I can
find the relevant parts

-- 
View this message in context: 
http://old.nabble.com/Learn-to-use-GtkAda-tp32012833p32012833.html
Sent from the Gtk+ - Ada mailing list archive at Nabble.com.




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-07 13:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-07 13:15 Trying to learn Gtk Ada ldries46

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox