sábado, 17 de junio de 2006

Monodevelop 1.1.15 (beta) for newbies

This How-to is a rapid explanaition of how to use the new gui features in the monodevelop.

First, when you launch Monodevelop (and get a few loading errors), you get an empty workspace. You need to create a "New Solution" from the Menu File, choose Gtk# 2.0 Project.

The first thing to do is to activate the Widgets panels, this is a new feature in the 1.1.15 beta version, we don't need an external glade file to be imported (see the Menu View).

Once the new blank solution is created, we get a basic source code, the Main class, the Stetic class wich contains all of the widgets constructors and initial values, and a MainWindow class where all widgets must be controlled.

Selecting the MainWindow.cs file in the "Classes" Viewer we get the source code and the option to show the "Designer".



The Window looks like this:



As in glade, you can add your widgets in real time and see how the look, and edit it's properties. Eg. add a VBox widget with the 3 default spaces, add a Label, an Entry and a Button.

The key of this gui editor is the buttton "Bind to field", you have to click any champ for creating a variable. The new variable will be created in the MainWindow class where we can manipulate all the widgets properties related on the fly, as any other gnome application.





For example, for changing the label1 shown in the picture above with the values typed in the entry1, let's say, after a click in the button, we need the following main steps:

  1. Create a function associated with the signal
    1. Choose the button, and select Widget Properties,
    2. In the Signals, locate the Clicked signal, and double click it.
    3. Automaticaly, a function associated to this signal appears in the MainWindow class.
  2. Add the new feature
    1. Locate the function in the MainWindow class, you may double click it in the classes viewer
    2. Add the following command:
      1. label1.Text = entry1.Text;
Oh I did forget it, the most important thing, press F5 to run as usual, and don't forget to save your files.

This is beta software.

Visit:
http://www.mono-project.com/Main_Page
http://www.monodevelop.com/Download