Nick,
I tried to
install GTK# but I haven’t been able to.� Do I have to actually compile the
GTK# source files?� Is there an installable executable that I can run which
will properly install GTK# on my computer?
I’m running this
on Windows 2000 with the .NET Service Pack 1 installed.
Amrit
----
Amrit Kohli
[EMAIL PROTECTED]
-----Original Message-----
From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nick Loeve
Sent: Tuesday, October 12, 2004
9:33 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [Mono-list]
HelloWorld.cs
try
compiling with:
msc -pkg:gtk-sharp helloworld.cs
Thats assuming you have GTK# installed....
On 13/10/2004, at 10:50 AM, Amrit Kohli wrote:
I am still learning
mono and C#, so forgive me what is probably a very easy question for most of
you./x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
I entered the following code
from a HelloWorld type of application:/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
// helloworld.cs - Gtk# Tutorial
example/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
namespace GtkSharpTutorial {/x-tad-bigger>/fontfamily>
using Gtk;/x-tad-bigger>/fontfamily>
using GtkSharp;/x-tad-bigger>/fontfamily>
using System;/x-tad-bigger>/fontfamily>
using System.Drawing;/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
public class helloworld {/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/* This is a callback function. The data arguments are ignored/x-tad-bigger>/fontfamily>
* in this example. More on callbacks below. *//x-tad-bigger>/fontfamily>
static void hello (object obj, EventArgs args)/x-tad-bigger>/fontfamily>
{/x-tad-bigger>/fontfamily>
Console.WriteLine("Hello World");/x-tad-bigger>/fontfamily>
Application.Quit ();/x-tad-bigger>/fontfamily>
}/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
static void delete_event (object obj, DeleteEventArgs args)/x-tad-bigger>/fontfamily>
{/x-tad-bigger>/fontfamily>
/* If you return FALSE in the "delete_event" signal handler,/x-tad-bigger>/fontfamily>
* GTK will emit the "destroy" signal. Returning TRUE means/x-tad-bigger>/fontfamily>
* you don't want the window to be destroyed./x-tad-bigger>/fontfamily>
* This is useful for popping up 'are you sure you want to quit?'/x-tad-bigger>/fontfamily>
* type dialogs. *//x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
Console.WriteLine ("delete event occurred\n");/x-tad-bigger>/fontfamily>
Application.Quit ();/x-tad-bigger>/fontfamily>
}/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
public static void Main(string[] args)/x-tad-bigger>/fontfamily>
{/x-tad-bigger>/fontfamily>
/* This is called in all GTK applications. Arguments are parsed/x-tad-bigger>/fontfamily>
* from the command line and are returned to the application. *//x-tad-bigger>/fontfamily>
Application.Init ();/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/* create a new window *//x-tad-bigger>/fontfamily>
Window window = new Window ("helloworld");/x-tad-bigger>/fontfamily>
/* When the window is given the "delete_event" signal (this is given/x-tad-bigger>/fontfamily>
* by the window manager, usually by the "close" option, or on
the/x-tad-bigger>/fontfamily>
* titlebar), we ask it to call the delete_event () function/x-tad-bigger>/fontfamily>
* as defined above. The data passed to the callback/x-tad-bigger>/fontfamily>
* function is NULL and is ignored in the callback function. *//x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
window.DeleteEvent += new DeleteEventHandler (delete_event);/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/* Sets the border width of the window. *//x-tad-bigger>/fontfamily>
window.BorderWidth = 10;/x-tad-bigger>/fontfamily>
/* gtk_container_set_border_width (GTK_CONTAINER (window), 10);*//x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/* Creates a new button with the label "Hello World". *//x-tad-bigger>/fontfamily>
Button btn = new Button ("Hello World");/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/* When the button receives the "clicked" signal, it will call the/x-tad-bigger>/fontfamily>
* function hello() passing it NULL as its argument. The hello()/x-tad-bigger>/fontfamily>
* function is defined above. *//x-tad-bigger>/fontfamily>
btn.Clicked += new EventHandler (hello);/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/* This packs the button into the window (a gtk container). *//x-tad-bigger>/fontfamily>
window.Add (btn);/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/* The final step is to display this newly created widget. *//x-tad-bigger>/fontfamily>
window.ShowAll ();/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/* All GTK applications must have a gtk_main(). Control ends here/x-tad-bigger>/fontfamily>
* and waits for an event to occur (like a key press or/x-tad-bigger>/fontfamily>
* mouse event)./x-tad-bigger>/fontfamily>
* In C#, we use Application.Run(), as used in Windows.Forms*//x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
Application.Run ();/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
}/x-tad-bigger>/fontfamily>
}/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
}/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
When I tried to compile it, I
got the following errors:/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
helloworld.cs(20) error
CS0246: Cannot find type `DeleteEventArgs'/x-tad-bigger>/fontfamily>
helloworld.cs(4) error
CS0246: The namespace `Gtk' can not be found (missing assembly reference?)/x-tad-bigger>/fontfamily>
Try using
-r:gtk-sharp/x-tad-bigger>/fontfamily>
helloworld.cs(5) error
CS0246: The namespace `GtkSharp' can not be found (missing assembly reference?)/x-tad-bigger>/fontfamily>
Try using
-r:gtk-sharp/x-tad-bigger>/fontfamily>
helloworld.cs(7) error
CS0246: The namespace `System.Drawing' can not be found (missing assembly
reference?)/x-tad-bigger>/fontfamily>
Try using -r:System.Drawing/x-tad-bigger>/fontfamily>
Compilation failed: 4
error(s), 0 warnings/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
So, I tried to do :/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
�
/x-tad-bigger>
/x-tad-smaller>/smaller>/fontfamily>
mcs –r:gtk-sharp
helloworld.cs/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
That produced the error
message:/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
error CS0006: Cannot find
assembly `gtk-sharp'/x-tad-bigger>/fontfamily>
Log:/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
Compilation failed: 1 error(s),
0 warnings/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
How do I install the GTK
libraries? I am using mono v1.0.2 for windows. I’m guessing from
the little bit of research I’ve done that I have to compile the GTK# source
into an “assembly” or binary. Also, where would I put the GTK libraries
when I finally do install them?/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
Thanks,/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>
Amrit/x-tad-bigger>/fontfamily>
----/x-tad-bigger>/fontfamily>
Amrit Kohli/x-tad-bigger>/fontfamily>
[EMAIL PROTECTED]/x-tad-bigger>/fontfamily>
/x-tad-bigger>/fontfamily>