几个月前,我开始使用 GTK 库使用 FreeBASIC 进行编程,这样应用程序就可以在 Windows 和 Linux 上运行,而无需重写代码,但作为初学者,我只设法创建了掩码,但我不知道如何处理按下按钮。
有人可以告诉我我需要做什么来处理按钮按下吗?
#INCLUDE ONCE "gtk/gtk.bi"
gtk_init(@__FB_ARGC__, @__FB_ARGV__)
DIM SHARED AS GtkBuilder PTR XML
DIM SHARED AS GObject PTR _
mainWindow, Main_CloseButton
XML = gtk_builder_new()
SCOPE
DIM AS GError PTR meld
VAR GUISTR = SADD( _
"<?xml version=""1.0"" encoding=""UTF-8""?>" _
"<!-- Generated with glade 3.38.2 -->" _
"<interface>" _
"<requires lib=""gtk+"" version=""3.24""/>" _
"<object class=""GtkWindow"" id=""mainWindow"">" _
"<property name=""can-focus"">False</property>" _
"<child>" _
"<object class=""GtkLayout"">" _
"<property name=""visible"">True</property>" _
"<property name=""can-focus"">False</property>" _
"<child>" _
"<object class=""GtkButton"" id=""Main_CloseButton"">" _
"<property name=""label"" translatable=""yes"">Close</property>" _
"<property name=""width-request"">80</property>" _
"<property name=""height-request"">30</property>" _
"<property name=""visible"">True</property>" _
"<property name=""can-focus"">True</property>" _
"<property name=""receives-default"">True</property>" _
"</object>" _
"<packing>" _
"<property name=""x"">350</property>" _
"<property name=""y"">200</property>" _
"</packing>" _
"</child>" _
"</object>" _
"</child>" _
"</object>" _
"</interface>" _
!"\0")
IF 0 = gtk_builder_add_from_string(XML, GUISTR, -1, @meld) THEN
WITH *meld
?"Error (GTK-Builder):"
?*.message
END WITH
g_error_free(meld)
END 2
END IF
END SCOPE
mainWindow = gtk_builder_get_object(XML, "mainWindow")
Main_CloseButton = gtk_builder_get_object(XML, "Main_CloseButton")
gtk_builder_connect_signals(XML, 0)
g_object_unref(XML)
gtk_widget_show_all(GTK_WIDGET(mainWindow))
gtk_main()