GtkAda简单聊天错误 [英] GtkAda simple chat error
问题描述
我正在用Ada编写简单的聊天程序,并且在聊天窗口模拟方面遇到问题-单击按钮时,它会读取文本表单条目并将其放在text_view上。这是我编写的代码,这是编译输出:
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
谁能告诉我这是什么问题,因为我不知道为什么过程 Get_Buffer
期望 Gtk_Text_Iter
,以及为什么 Get_Text
是否缺少启动参数?
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.
在您的示例中,您调用 Gtk.Text_Buffer.Get_Buffer
,而不是正确的 Gtk.Text_View.Get_Buffer
。这是因为您与
和使用
使用Gtk.Text_Buffer,但不要使用
Gtk.Text_View。
使用时应小心。
In your example, you call Gtk.Text_Buffer.Get_Buffer
, not the correct Gtk.Text_View.Get_Buffer
. This is because you with
and use
Gtk.Text_Buffer, but don't use
Gtk.Text_View. You should be careful what you use
. Same for Get_Text.
如果为Gtk.Text_View和Gtk.GEntry添加 use
子句,这些错误应该消失
If you add use
clauses for Gtk.Text_View and Gtk.GEntry, those errors should disappear.
但是我给你一个建议:尝试使用尽可能少的 use
子句。这样,您便始终知道真正调用了什么函数。
But I give you an advice: try to use as few as possible use
clauses. That way you always know what function is really called.
TLDR:使用Gtk.Text_View添加;使用Gtk.GEntry;
到 On_Btn_Send_Clicked
过程的声明部分。
TLDR: Add use Gtk.Text_View; use Gtk.GEntry;
to the declaration part of the On_Btn_Send_Clicked
procedure.
这篇关于GtkAda简单聊天错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!