AdaCore / gtkada

Ada bindings for the GTK+ graphical library.
Other
88 stars 20 forks source link

function Get_Text (The_Entry : access Gtk_Entry_Record) return UTF8_String; #1

Closed dead-crow closed 8 years ago

dead-crow commented 8 years ago

Hi ,

I want to use the Get_text function, without signals connection , but it won't compile . I obtain the following errors = prototype.adb:74:14: expected type "Gtk_Entry" defined at gtk-gentry.ads:59 prototype.adb:74:14: found type "Standard.String"

Here is the complete code . As you can see , i'm already using a variable for "Gtk_Entry" .

WITH Gtk.Main ; USE Gtk.Main ; WITH Gtk.Window ; USE Gtk.Window ; WITH Gtk.Enums ; USE Gtk.Enums ; WITH Gtk.Button ; USE Gtk.Button ; WITH Gtk.Alignment ; USE Gtk.Alignment ; WITH Gtk.Box ; USE Gtk.Box ; WITH Gtk.Gentry; USE Gtk.Gentry;

PROCEDURE prototype IS


-- VARIABLES --

win : Gtk_window ;

Btn1, Btn2 ,Btn3 : Gtk_Button ;

alignG, alignM ,alignD : Gtk_Alignment ;

Boite : Gtk_VBox ;

Boutons : Gtk_HBox ;

saisie : Gtk_Entry ;


BEGIN

Init ;


-- NEW --

Gtk_New(win);

Gtk_New(saisie);

Gtk_New(Btn1, "Bouton 1") ; Gtk_New(Btn2, "Bouton 2") ; Gtk_New(Btn3, "Bouton 3") ;

Gtk_New(alignG,0.0,1.0,1.0,1.0); Gtk_New(alignM,0.5,1.0,1.0,1.0); Gtk_New(alignD,1.0,1.0,1.0,1.0);

Gtk_New_VBox (Boite, homogeneous => false, Spacing => 0) ;

Gtk_New_HBox (Boutons, homogeneous => false, Spacing => 0) ;


Boite.Pack_Start(saisie); Boite.Pack_Start(Boutons); Boutons.Pack_Start(alignG); Boutons.Pack_Start(alignM); Boutons.Pack_Start(alignD);


-- Add

alignG.add(Btn1) ; alignM.add(Btn2) ; alignD.add(Btn3) ;

win.Add(Boite);


saisie := Get_text(saisie);

win.Set_Default_Size(500,500) ;

win.set_position(Win_Pos_Mouse) ;

-- win.set_opacity(0.7) ;

win.Show_all ; Main ;

END prototype ;

briot commented 8 years ago

I want to use the Get_text function, without signals connection , but it won't compile

I obtain the following errors = prototypeadb:74:14: expected type "Gtk_Entry" defined at gtk-gentryads:5 prototypeadb:74:14: found type "StandardString"

Here is the complete code As you can see , i'm already using a variable for "Gtk_Entry"

The return type of Get_Text is a string, which is what the compiler is telling you. You are assigning to a Gtk_Entry.

regards Emmanuel

dead-crow commented 8 years ago

Thanks Emmanuel . It work fine now . Next stage = Signals .