Re: [Vala] Changing label when a button is clicked
- From: Frederik <scumm_fredo gmx net>
- To: vala-list <vala-list gnome org>
- Subject: Re: [Vala] Changing label when a button is clicked
- Date: Thu, 20 Aug 2009 08:57:05 +0200
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]