[Gtk-sharp-list] Re: Improving Gtk#

Todd Berman tberman@off.net
Tue, 26 Apr 2005 12:31:05 -0700

On Tue, 2005-04-26 at 18:42 +0000, Christopher Nehren wrote:
> Hash: SHA1
> On 2005-04-26, Miguel de Icaza scribbled these
> curious markings:
> > Hello,
> >
> >    As people develop applications with Gtk#, I would love to hear
> > people's opinion on what we can do to make Gtk# better.  
> Better? I'm practically drooling on it right now. :)
> >         * What things do you find obnoxious, annoying about Gtk#?
> The fact that I need to do casting to use MessageDialogs. Consider the
> following code:
> <-- cut -->
> MessageDialog md = new MessageDialog(this.w,
>                                        DialogFlags.DestroyWithParent,
>                                        MessageType.Question,
>                                        ButtonsType.YesNo,
>                                        "Quit No Name Browser?");
>                        ResponseType ret = (ResponseType)md.Run();
> <-- cut -->
> I don't like that cast to ResponseType that's preceding the md.Run()
> call. Am I missing something (quite likely) here? IMO, casting is for
> those still using C. I like that C# mostly obviates the requirement for
> casting. If a newer version removes the need for casting, I'll
> definitely be drooling on it.

That cast is actually a very good thing. You can write dialogs that
return custom response types. the Run method returning an integer allows
this to work easily. The other way would work as well (returning as
ResponseType, casting to int if needed) as long as the gtk# GEnum
marshalling can handle it (I believe it can).

> >         * What kind of tutorials you would like to see?
> The obvious: the C GTK+ tutorial translated to C#. I'd volunteer to
> write it myself, but there's a bit of a chicken and egg problem. I can't
> write the tutorial because I don't know enough about it to write it, and
> I don't feel that I can learn enough about it to write it because I
> can't read it to learn enough about it to write it. :P

Do you mean the GtkDemo? Available in the samples/GtkDemo/ directory of
gtk#. Or is this a separate tutorial. If so, please send the url to the
list, and if I get a chance, maybe I will translate it.