Sunday, November 28, 2004

Starting a Mono project

One of the future events in the NET GEMS project is the development of a cross-platform tagging program. I started that tonight (but don't worry, Hall, I won't let it keep me from the tagging :) ... I promise). I plan on doing this just a little bit at a time because I have so much else to do right now, which includes preparing the text for tagging and preparing our morphological database. And then, of course, there is tagging to do as well! This should keep me busy, especially since I also have family and other responsibilities as well. But, it is something that needs to be done, and it will give me familiarity with the dev environment I'll need when I do some of the other many projects that are running around in my head at the moment.

I'm doing this using Mono, the cross-platform C# development platform developed around the ECMA standardized parts of the Microsoft .NET programming platform. In Mono interfaces are built using Gtk# (extension to the Gtk+ libraries already available) and Glade# (extension of the Glade interface building tools). I already had Mono and the Visual Studio add-in already installed, so all I needed to get was the Glade Interface Builder and I was ready to go.

It is definitely different from the Windows Forms development that I've gotten used to, but hopefully it won't come as too much of a system shock. The Glade builder is definitely a change; you don't place widgets based on coordinates like in a Winform development project. But I'm sure I'll get used to it.

There's really only two major headaches that really need to be beaten for me to be sure this way of doing cross-platform develpment will work: Gtk# needs to meet my needs as a GUI toolkit and there needs to be an easy way to install the Mono framework, the Gtk# libraries, and Mono projects. The first I should know sooner than the second.

I plan on putting tidbits about Gtk#/C# development every once in a while, as I accomplish something. If you are not a code-oriented individual, you will probably find this stuff rather boring...

What I've Learned So Far:

First, since all the widgets are stored as xml and not a part of the code itself, you have to import the widget from the xml file. This is actually pretty easy:

[Widget] Gtk.Entry theNameOfMyWidget;

After that you can do whatever you want. In this case, an "Entry" widget is like a textbox, so you can do something like the following:

theNameOfMyWidget.Text = "This text goes in the textbox.";

Also, here is the equivalent of a Windows Forms "MessageBox.Show('Hello, World!');" command:

Gtk.MessageDialog dialog = new Gtk.MessageDialog(MainWindow, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "Hello, World!");

At least that's one of the constructor overloads for the class. I haven't figured out yet how to hook up the button to a method yet, but hopefully I'll figure that out pretty quickly.

Now I'm off to watch "Miracle" with the wife. Later.



0 Comments:

Post a Comment

<< Home