[Vala] Accessing some widget's properties which is declared in the "main" function from out side function.



Hi.
My main look's like this:

  public static int main (string[] args)
  {
    Gtk.init (ref args);
    try {
        var builder = new Builder ();
        builder.add_from_file ("Repositor.ui");
        builder.connect_signals (null);
        var window = builder.get_object ("win_main") as Window;
        var txtKey = builder.get_object ("txtKey") as TextView;

        window.show_all ();
        window.destroy += Gtk.main_quit;
        Gtk.main ();
    } catch (Error e) {
        stderr.printf ("Could not load UI: %s\n", e.message);
        return 1;
    }

    return 0;
  }

And I have another function which handles events of a button that is placed
on the same window:

public static void on_btnProc_clicked (Button source) {
    source.label = "Thank you!";
    //Gtk.main_quit();
    source.get_parent().txtKey.hide();    <===============================
How do I do that correctly ???
}

I want to access "txtKey" which is declared in the "main" function....
Maybe for you guys it is a very simple task, but I am very new to VALA...
Thanks alot...


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]