[Mono-list] Simple Gtk# hello world app

Baltasar García Perez-Schofield baltasarq at gmail.com
Wed Mar 5 09:39:26 UTC 2014

	Hi, Michael,

> I never heard back further from my failed attempt to start building a
> HelloWorld C# Gtk# test application. My reply was as follows:
> Attempting to create a HelloWorld C# Gtk# raises the error I posted. I never
> get to the editor screens.
> I am attempting with 4.2.2 on Xubuntu 12.04 x64. Seems we are working with
> quite similar configuration.

	I am working with MonoDevelop in LUbuntu 13.10 x64
	The only step I took in order to have a working mono environment were:

	$ sudo apt-get mono-complete monodevelop

	In order to create a Gtk# App:

	- Create a Gtk# 2.0 project (File >> New >> Solution >> C# >> Gtk# 2.0)
	- Select the MainWindow.cs file on the project tree at the left.
	- Select designer on the bottom of the screen, and add a Container >> VBox, delete one of the three partitions, and in the other two place a Label and a Button.
	- Change the label labelprop to "Hello, world!"
	- Change the button label property to "Dismiss".
	- In the properties panel of the button, select signals, go to Button Signals, and on "Clicked" type "OnDismiss" (without the quotes) and press Enter.
	- Go the the source.
	- Inside the OnDismiss() method, type
		"this.Hide(); Application.Quit();".
	- That's it! Run the application, and you should have the desired results.

	Hope this helps.

Baltasar (baltasarq at gmail.com  http://baltasarq.info/)

More information about the Mono-list mailing list