Am 08.05.2012 23:58, schrieb [email protected]:
Check this, updated, example:
http://pastebin.com/vRMWHrNp

Thank you for answering. The example goes like this:
        [...]
        var button = new Button.with_label ("Click me")
        button.clicked.connect (clicked_cb)
        add (button)

    def clicked_cb (btn : Button)
        title = "Hello World"
        btn.label = "Hello World"

I don't think that this is a real closure. The idea is, that the complete callback is defined inside the connect ( def of callback ) like in the old, deprecated example. Is this possible with connect?

-Klaus

On Tue, May 8, 2012 at 4:37 PM, Klaus Rotter <[email protected]
<mailto:[email protected]>> wrote:

    Hello!

    An old (deprecated) way to define closures in genie is e.g:

      var button = new Button.with_label("Click me!")
      button.clicked += def()
        button.label = "Thank you"

    However, the compiler throws a warning, that this way is deprecated
    and recommends 'connect' instead. But, I really can't figure out the
    syntax connect works. Has anybody an example for this? Thank you!

--
 Klaus Rotter * klaus at rotters dot de * www.rotters.de
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to