[Vala] can't receive scroll event in object's method




-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all:

I'm trying to receive the scroll event in an object, but I'm unable to
do it. If I do:

        [...]
        this.mybox = new EventBox();
        mybox.add_events (Gdk.EventMask.SCROLL_MASK);
        mybox.scroll_event.connect(do_scroll);
        [...]

    public static bool do_scroll(Gtk.Widget w,Gdk.EventScroll event) {
   
        GLib.stdout.printf("Scroll\n");
        return true;
    }

it works, but since "do_scroll" is static, it has no access to the
original object. But if I try to use a method in the object, to be
able to use "this.", like in:

        [...]
        this.mybox = new EventBox();
        mybox.add_events (Gdk.EventMask.SCROLL_MASK);
        mybox.scroll_event.connect(do_scroll);
        [...]

    public bool do_scroll(Gtk.Widget w,Gdk.EventScroll event) {
   
        GLib.stdout.printf("Scroll\n");
        this.call_to_an_objects_method();
        return true;
    }

it never receives the scroll event.

I also tried to add [CCode(instance_pos=-1)] before the method, but it
doesn't work :(

What must I do to make it work?

Thanks.

- -- 
Nos leemos
                 RASTER    (Linux user #228804)
raster rastersoft com              http://www.rastersoft.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6CIGUACgkQXEZvyfy1ha/J6wCgp141uFD6pH3tpi5+Ne779y38
OyoAnivS/ALqUgGTGG8GEYk3OJQHgpNt
=NjBE
-----END PGP SIGNATURE-----




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