I’m writing simple chat program in Ada, and I’m having problem with chat window simulation – on button clicked it reads text form entry and puts it on text_view. Here is the code I’ve written and here is the compile output:
gnatmake client `gtkada-config`
gcc -c -I/usr/include/gtkada client_pkg.adb
client_pkg.adb:14:19: no candidate interpretations match the actuals:
client_pkg.adb:14:37: expected private type "Gtk_Text_Iter" defined at gtk-text_iter.ads:48
client_pkg.adb:14:37: found type "Gtk_Text_View" defined at gtk-text_view.ads:58
client_pkg.adb:14:37: ==> in call to "Get_Buffer" at gtk-text_buffer.ads:568
client_pkg.adb:14:37: ==> in call to "Get_Buffer" at gtk-text_buffer.ads:407
client_pkg.adb:15:34: no candidate interpretations match the actuals:
client_pkg.adb:15:34: missing argument for parameter "Start" in call to "Get_Text" declared at gtk-text_buffer.ads:283
client_pkg.adb:15:34: missing argument for parameter "Start" in call to "Get_Text" declared at gtk-text_buffer.ads:270
gnatmake: "client_pkg.adb" compilation error
Can anyone tell me what is the problem, since I have no idea why procedure Get_Buffer expects Gtk_Text_Iter, and why Get_Text miss Start parameter?
You have to call the correct procedures/functions.
In your example, you call
Gtk.Text_Buffer.Get_Buffer, not the correctGtk.Text_View.Get_Buffer. This is because youwithanduseGtk.Text_Buffer, but don’tuseGtk.Text_View. You should be careful what youuse. Same for Get_Text.If you add
useclauses for Gtk.Text_View and Gtk.GEntry, those errors should disappear.But I give you an advice: try to use as few as possible
useclauses. That way you always know what function is really called.TLDR: Add
use Gtk.Text_View; use Gtk.GEntry;to the declaration part of theOn_Btn_Send_Clickedprocedure.