[Vala] [Genie] Problem with derived compact classes



Hello,

I try to create a non gtk object and i have one problem:
If i create a simple gtk object like this:

[indent=4]

uses
    Gtk

class MyLabel : Gtk.Label

    a : string = "Salut !"

    init
        this.set_text(a)

init
    Gtk.init (ref args)
    var window = new Window (Gtk.WindowType.TOPLEVEL)
    window.destroy.connect(Gtk.main_quit)
    var label = new MyLabel()
    window.add(label)
    label.show()
    window.show()
    Gtk.main()

It build and work correctly.
Now if i want to create an Evas.Object like this:

[indent=4]

uses
    Evas

class Test : Evas.Image

    a : string = "hello"

    construct (canvas : Evas.Canvas)
        super(canvas)

init
    print "Just a build test"

I have this problem:
error: derived compact classes may not have instance fields
The problem is:
a : string = "hello"

Someone knows what can i do to avoid this ?
Thanks in advance,
Nicolas.



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