GTK# Tutorial

I’ve decided, as I may have mentioned before, that I plan on using C# and GTK# built using MonoDevelop as my cross-platform platform of choice. I’ve always had one problem with this – getting the GUI to be responsive.

You have to understand that I’ve been programming a long time (the first program I wrote I had to flip the toggle switches on the front panel to toggle in the 0′s and 1′s), but just about everything I’ve done has been command line based. Mostly utility programs, programs that operate behind the scenes, programs that are used by other developers or systems people – in short, nothing graphical in nature. This is a whole new issue for me.

So, of course,  the first thing you do is hit Google, or the C#/GTK# pages looking for a tutorial on how to do this. I found a problem here – there are a lot of tutorials, but they’re relatively static. That is, they show how to put a button and a text display on a page, press the button and update the text display. Those tutorials work, but they don’t expand well.

I’m working on programs that put up a display, take some input, and then go off and do some work. This work is supposed to give feedback to the user so they know what’s happening. The tutorials I found don’t do that.

Thus was born this tutorial in which I use Glade# to develop the interface and then use GTK# to run a simple little program that picks a number between 1 and 10,000 and then tries to determine what that number is. While it’s guessing, it’s updating the GUI to show the current guessed number and how many guesses it’s taken so far.

I don’t claim that this is extensible to the most complex program, it’s worked for this tutorial and now I’m off to implement this method in a larger program to see how well it works there.

I’ve included links to a MonoDevelop and a VS2005 solution. Please download and give them a try. Feedback is most welcome.

Hopefully someone will find this useful.

MonoDevelop Solution for the tutorial

VS2005 Solution for the tutorial

Stumble it!

Explore posts in the same categories: Coding

Comment:

You must be logged in to post a comment.