I am writing a simple program that changes the label when a button is
clicked, but I am getting the following error when the button is
clicked:
Gtk-CRITICAL **: gtk_label_set_text: assertion `GTK_IS_LABEL (label)' failed
I am only able to change the label when the label is declared as
"private static Label label"
Help is appreciated, thank you very much!!
using Gtk;
/*
valac sample.vala --pkg gtk+-2.0
*/
public class Main {
private Button button;
private Label label;
private void changeLabel() {
label.set_text( "Clicked" );
}
public Main() {
button = new Button();
label = new Label("Not Clicked");
var window = new Window( WindowType.TOPLEVEL );
var vbox = new VBox(true, 10);
button.label = "Click Me!";
button.clicked.connect( (source) => {
changeLabel();
});
vbox.add( button );
vbox.add( label );
window.add( vbox );
window.show_all();
}
public static int main( string[] args ) {
Gtk.init ( ref args );
new Main();
Gtk.main();
return 0;
}
}
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list