PDA

View Full Version : Mono and GTK#



Lord Illidan
July 25th, 2007, 07:03 PM
Hi guys/gals.

I am trying to learn more about mono and gtk#, and I've been looking at some internet resources to speed me on my way, yet I've come across a funny stumbling block.

On this site, http://www.mono-project.com/GtkSharp:_Frames, I found the following example.

// frame.cs - Gtk# Tutorial example
//
// Author: Johannes Roith >johannes@jroith.de<
//
// (c) 2002 Johannes Roith

namespace GtkSharpTutorial {
using Gtk;
using System;
using System.Drawing;


public class frame
{

static void delete_event (object obj,
DeleteEventArgs args)
{
Application.Quit();
}

public static void Main( string[] args)
{

/* Initialise GTK */
Application.Init();

/* Create a new window */
Window window = new (http://www.google.com/search?q=new+msdn.microsoft.com) Window ("Frame
Example");

/* Here we connect the "destroy" event to a
signal handler */
window.DeleteEvent += delete_event;

window.SetSizeRequest(300, 300);
/* Sets the border width of the window. */
window.BorderWidth= 10;

/* Create a Frame */
Frame frame = new (http://www.google.com/search?q=new+msdn.microsoft.com) Frame("MyFrame");
window.Add(frame);

/* Set the frame's label */
frame.Label = "GTK Frame Widget";

/* Align the label at the right of the
frame */

frame.SetLabelAlign((float)1.0,(float)0.0);

/* Set the style of the frame */
frame.ShadowType = (ShadowType) 4;

frame.Show();

/* Display the window & all widgets*/
window.ShowAll();

/* Enter the event loop */
Application.Run();

}

}

}
Apart from the confusion in using frame as an identifier TWICE, it doesn't seem bad. However, I get the following error when I run the program.

`Gtk.Frame' does not contain a definition for `SetLabelAlign'(CS0117)

Any ideas? In mono-doc, SetLabelAlign is mentioned...why is it not here?

Lord Illidan
July 25th, 2007, 07:19 PM
Interestingly, http://docs.gotmono.net does not mention SetLabelAlign.

However, I have another question.

public float (http://docs.gotmono.net/display.aspx?url=ecma%3a%2f%2fgo%3flink%3dT%253aSy stem.Single) LabelXalign { set; get; }

What does the set; get; mean?

Lord Illidan
July 25th, 2007, 07:32 PM
Aha..it seems that either the tutorial is an old one or that it has been removed. Google Code Search revealed nothing for SetLabelAlign, but Xalign and YAlign do the same thing I guess.

Still, my previous question remains.