Simon Chan wrote:
> Hi, Frederik.
> 
> Thank you, Frederik. I have been figuring this out for 2 nights.
> In java this works fine, I was scratching my head out.

Yes, Vala has a different memory management model than Java. Vala does
reference counting and Java does garbage collection. In Vala an
unreferenced object gets freed as soon as possible.

> Just one more question, if I connect the signal to a function instead
> of using lambda expression, does the function take parameter?
> 
> like " void changelabel( Widget source ) {} " ?

Yes, if the parameters match the expected parameters of the signal. You
can read about the exact behaviour on this wiki page:

http://live.gnome.org/Vala/SignalsAndCallbacks

For example:

--------------------------------------------------------
class Foo {
        signal void bar (int a, int b);
}

void on_bar (Foo source, int a, int b) {
        // ...
}

void main () {
        var foo = new Foo ();
        foo.bar.connect (on_bar);
}
--------------------------------------------------------


Best Regards,

Frederik
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to