[Gtk-sharp-list] Gtk.Timeout parameters
Jonathan Pryor
jonpryor@vt.edu
Tue, 28 Oct 2003 07:19:10 -0500
No. ``CheckButton()'' is a function invocation, not a delegate creation
expression, and thus will not work either.
It should be noted that the next version of C# (v2) will support the
implicit conversion from a function into a delegate type. This would
allow the original code to work:
Gtk.Timeout.Add (2000, CheckButton);
As the C# compiler could infer the appropriate delegate type, and ensure
that CheckButton has the appropriate signature.
But that's for v2 (as part of the anonymous methods extension), not now.
- Jon
On Tue, 2003-10-28 at 01:12, Richard Torkar wrote:
> On Mon, 2003-10-27 at 08:57, Leo Spalteholz wrote:
> > I'm trying to use a Gtk.Timeout but can't figure out how to use the Add()
> > function. The second argument calls for a Gtk.Function that will be
> > called every interval until the function returns false. I have this:
> >
> > Gtk.Timeout.Add(2000, CheckButton);
> >
> > private bool CheckButton() {}
> >
> > But I get the error:
> > Method `OpenSpeechSystem.TextScreen.CheckButton()' is referenced without
> > parentheses
> >
>
> Could it be like this:
> Gtk.TimeOut.Add (2000, CheckButton ());
> ?
>
> /Richard