Re: [Vala] Where is the sender widget in signal callback?
- From: gege2061 <gege2061 redaction-developpez com>
- To: Feng Yu <rainwoodman gmail com>
- Cc: vala <vala-list gnome org>
- Subject: Re: [Vala] Where is the sender widget in signal callback?
- Date: Fri, 10 Apr 2009 21:26:23 +0200
I posted too quickly. This code worked with valac 0.6.
The compiler show an error because 's' is a Gtk.Style, yet 's' is the first parameter, the sender, therefore is a Gtk.Button.
Here a sample code to reproduce the problem:
void main (string[] args){
Gtk.Window window; Gtk.Button button;
Gtk.init (ref args);
window = new Gtk.Window (Gtk.WindowType.TOPLEVEL); window.show += (s) => {
debug ("%s", s.get_type ().name ()); };
button = new Gtk.Button (); Gtk.RcStyle rcstyle = new Gtk.RcStyle ();
rcstyle.xthickness = rcstyle.ythickness = 0; button.modify_style (rcstyle);
button.style_set += (s) => { s.set_size_request (2, 2);
}; window.add (button);
window.show_all ();
Gtk.main ();}I solved the problem by adding the missing parameter:
button.style_set += (s, style) => {
s.set_size_request (2, 2);
};
It's a bug or a feature?
--
Nicolas Joseph
Responsable des rubriques C et GTK+ de
developpez.com /
In charge of the C and GTK+ sections on
developpez.com
http://nicolasj.developpez.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]