[Mono-docs-list] Re: [Gtk-sharp-list] MonkeyGuide?: Hello World in GNOME.NET -
Second Draft
Mike Kestner
mkestner@speakeasy.net
16 Feb 2003 01:10:04 -0600
--=-ORs7EKMeVAs2d9EOmVoV
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi Charles,
On Sat, 2003-02-15 at 18:50, Charles Iliya Krempeaux wrote:
> This second draft changes the use of the term "GNOME#" to
> "GNOME.NET". Contains some mirror corrections and various
> modifications. Adds an explanation of the "HelloWorld, third try"
> example code. Adds a "HelloWorld, fourth try" and "HelloWorld, fifth
> try" section. And has some other additions.
Thanks for the s/#/.Net/g. :) I told you I'd provide feedback on your
first draft and dropped the ball. Sorry about that. Thanks again for
working on this documentation.
Now for the comments. First a general comment. If you try to do a "this
is how to write object-oriented programs by splitting things up into
classes and separate files" type of document, you're going to end up
with a monstrously long document that anyone who's read a C# or Java
book is going to find redundant.
That said, here's my back-seat driver, "this is how I would structure
this document if I were writing it" feedback. :)
First Pass: just like your first try. Focus on Programs and App
windows. That's a nice high level overview of the main loop and the
toplevel window for a GNOME.Net app.
Second pass: I would combine your second and third try apps into one,
but restructure it as displayed in the attached file.
Things to highlight would be the subclassing of Gnome.App, which is a
more meaningful example in that it implements the DeleteEvent handler on
the Object that exposes DeleteEvent. Obviously, the implementation of
DeleteEventHandler, and the handling of the RetVal in delete_event are
other points of focus.
I don't think anything is really gained by subclassing Gnome.Program.
The only reason I can think of to subclass Program in an application
would be to add complex or lengthy argument handling.
4th and 5th tries as I indicated above would go away, since they aren't
really specific to programming in GNOME.Net. If you wanted to go beyond
the second pass example, I would suggest doing something like packing an
Entry, Label, and Button into an App window such that when the button is
clicked, the Label is updated to: "Hello <contents of Entry>, welcome to
GNOME.Net. That's not really GNOME specific though, and is probably
better suited for an extended Gtk# example.
--
Mike Kestner <mkestner@speakeasy.net>
--=-ORs7EKMeVAs2d9EOmVoV
Content-Disposition: attachment; filename=GdotNHW.cs
Content-Type: text/plain; name=GdotNHW.cs; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
namespace GNOMEdotNetSamples {
using Gnome;
using GtkSharp;
public class HelloWorld {
public static void Main (string[] argv)
{
Program prog = new Program ("Hello World", "1.0", Modules.UI, argv);
App win = new MainWindow (prog);
win.Show ();
prog.Run ();
}
}
public class MainWindow : App {
Program prog;
public MainWindow (Program prog) : base ("Hello World", "Hello World")
{
this.prog = prog;
DeleteEvent += new DeleteEventHandler (delete_event);
}
private void delete_event (object o, DeleteEventArgs args)
{
prog.Quit ();
args.RetVal = true;
}
}
}
--=-ORs7EKMeVAs2d9EOmVoV--