I have a case where I used the scroll event for an eventbox:
this.ebox.scroll_event.connect(this.on_scroll);
...
...
private bool on_scroll(Gdk.EventScroll event) {
...
return true;
}
This one works here with vala 0.12.0 and gtk+-2.24.4.
Regards
> -----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)
> [email protected] 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-----
>
> _______________________________________________
> vala-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/vala-list
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list