我試圖用glade/gtk/vala製作一個簡單的應用程序。到目前爲止,我有這樣的:如何在vala中使用gtk/glade
using Gtk;
class HelloWorldApp : GLib.Object {
const string UI = "test.glade";
public Window main_window;
[CCode (instance_pos = -1)]
public void on_btn_hello_clicked(Button source) {
stdout.printf("Hello, world");
}
construct {
Builder builder = new Builder();
builder.add_from_file(UI);
main_window = builder.get_object("window1") as Window;
main_window.destroy.connect(Gtk.main_quit);
builder.connect_signals(this);
}
}
class HelloWorld : GLib.Object {
public static int main(string[] args) {
Gtk.init (ref args);
HelloWorldApp h = new HelloWorldApp();
h.main_window.show_all();
Gtk.main();
return 0;
}
}
當我運行這一點,輸出: (的HelloWorld:22641):GTK的WARNING **:找不到信號處理器「on_btn_hello_clicked」 但除此之外,運行良好除了處理器不叫
我做錯了什麼?
有關於如何通過訪問http寫格萊德和瓦拉GUI應用程序的好inrtoductory教程:// demonicode .ghoster.io/how-to-write-a-gui-app-with-glade-interface-designer-and-vala/- 檢查一下,其實很簡單!我被困在這個好幾個月,直到我發現這個教程:( – uSeRnAmEhAhAhAhAhA 2013-12-02 08:50:29