[Gtk-sharp-list] Hello World help

Fabian Vargas favosys@express.net.co
Mon, 11 Nov 2002 11:36:08 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_000E_01C28976.86D16010
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Guys
After a lot of struggling, I was finally able to install gtk sharp 0.5 =
but when compiling the hello world example, I get the following message:
----
# mcs -r gtk-sharp -r glib-sharp hola.cs
hola.cs(15) error CS0019: Operator + cannot be applied to operands of =
type `GtkSharp.DeleteEventHandler' and `System.EventHandler'

Compilation failed: 1 error(s), 0 warnings

---

So this is caused by the line:=20

win.DeleteEvent +=3D new EventHandler (Window_Delete);

which apparently doesn't work with gtk# 0.5, so I tried installing gtk# =
0.4 but it didn't work (and installing 0.5 was not easy so I'd really =
like it if it worked).

So I changed the line to :

win.DeleteEvent =3D new EventHandler (Window_Delete);

and I got the following message:

----

# mcs -r gtk-sharp -r glib-sharp hola.cs
hola.cs(15) error CS0070: The event 'DeleteEvent' can only appear on the =
left-side of a +=3D or -=3D (except when used from within the type =
'Gtk.Widget')

Compilation failed: 1 error(s), 0 warnings

----

So I just took the line off and it compiled, but when I run it the =
following appears:

-----

mono hola.exe

** ERROR **: No GCHandle support built-in

aborting...

Aborted

----

So now I really don't know what to do, all the examples (button, menu, =
conversion) have the same line.

Here's the complete code:

namespace GtkSamples {
 using Gtk;
 using Gdk;
 using GtkSharp;
 using System;
 using System.Drawing;
=20
 public class Hola{
  public static int Main(string[] args)
  {
   Application.Init();
   Gtk.Window win =3D new Gtk.Window(Gtk.WindowType.Toplevel);
   win.Title =3D "Gtk# Hola!!!!";
   win.DeleteEvent +=3D new EventHandler (Window_Delete);
   win.ShowAll();
   Application.Run();
   return 0;
  }
  static void Window_Delete(object obj, EventArgs args)
  {
   SignalArgs sa =3D (SignalArgs) args;
   Application.Quit();
   sa.RetVal =3D true;
  }
}=20

This is what I installed (all downloaded Nov 9-10) in the order I did =
it:

pkgconfig-0.14.0

glib-2.0.7

pango-1.0.5

atk-1.0.3

libxml2-2.4.26

gtk+-2.0.8

mono-0.16

gtk-sharp-0.5

I'm running a SuSE 8 Linux System, the above installation also required =
some packages which I installed from SuSE like =
gcc,libtool,autoconf,bison,X11, etc

Any help I'd appreciate, I have a mono conference tomorrow and I just =
want to run a simple graphic example to demonstrate mono.

Thanks

Fabian


------=_NextPart_000_000E_01C28976.86D16010
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2719.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Guys</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>After a lot of struggling, I was =
finally able to=20
install gtk sharp 0.5 but when&nbsp;compiling the hello world example, I =
get the=20
following message:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>----</FONT></DIV>
<DIV><FONT face=3DArial size=3D2># mcs -r gtk-sharp -r glib-sharp=20
hola.cs</FONT></DIV>
<DIV><FONT size=3D2>
<P>hola.cs(15) error CS0019: Operator + cannot be applied to operands of =
type=20
`GtkSharp.DeleteEventHandler' and `System.EventHandler'</P>
<P>Compilation failed: 1 error(s), 0 warnings</P>
<P>---</P>
<P>So this is caused by the line: </P>
<P><FONT face=3DArial>win.DeleteEvent +=3D new EventHandler=20
(Window_Delete);</FONT></P>
<P><FONT face=3DArial>which apparently doesn't work with gtk# 0.5, so I =
tried=20
installing gtk# 0.4 but it didn't work (and installing 0.5 was not easy =
so I'd=20
really like it if it worked).</FONT></P>
<P><FONT face=3DArial>So I changed the line to :</FONT></P>
<P><FONT face=3DArial>win.DeleteEvent&nbsp;=3D new EventHandler=20
(Window_Delete);</FONT></P>
<P><FONT face=3DArial>and I got the following message:</FONT></P>
<P><FONT face=3DArial>----</FONT></P>
<DIV><FONT face=3DArial size=3D2># mcs -r gtk-sharp -r glib-sharp=20
hola.cs</FONT></DIV><FONT size=3D2>
<P>hola.cs(15) error CS0070: The event 'DeleteEvent' can only appear on =
the=20
left-side of a +=3D or -=3D (except when used from within the type =
'Gtk.Widget')</P>
<P>Compilation failed: 1 error(s), 0 warnings</P>
<P>----</P>
<P>So I just took the line off and it compiled, but when I run it the =
following=20
appears:</P>
<P>-----</P>
<P>mono hola.exe</P><FONT size=3D2>
<P>** ERROR **: No GCHandle support built-in</P>
<P>aborting...</P>
<P>Aborted</P>
<P>----</P>
<P>So now I really don't know what to do, all the examples (button, =
menu,=20
conversion) have the same line.</P>
<P>Here's the complete code:</P>
<P><FONT face=3DArial>namespace GtkSamples {<BR>&nbsp;using =
Gtk;<BR>&nbsp;using=20
Gdk;<BR>&nbsp;using GtkSharp;<BR>&nbsp;using System;<BR>&nbsp;using=20
System.Drawing;<BR>&nbsp;<BR>&nbsp;public class =
Hola{<BR>&nbsp;&nbsp;public=20
static int Main(string[]=20
args)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;Application.Init();<BR>&nbsp;=
&nbsp;&nbsp;Gtk.Window=20
win =3D new =
Gtk.Window(Gtk.WindowType.Toplevel);<BR>&nbsp;&nbsp;&nbsp;win.Title =3D=20
"Gtk# Hola!!!!";<BR>&nbsp;&nbsp;&nbsp;win.DeleteEvent +=3D new =
EventHandler=20
(Window_Delete);<BR>&nbsp;&nbsp;&nbsp;win.ShowAll();<BR>&nbsp;&nbsp;&nbsp=
;Application.Run();<BR>&nbsp;&nbsp;&nbsp;return=20
0;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;static void Window_Delete(object obj, =

EventArgs args)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;SignalArgs sa =3D=20
(SignalArgs)=20
args;<BR>&nbsp;&nbsp;&nbsp;Application.Quit();<BR>&nbsp;&nbsp;&nbsp;sa.Re=
tVal =3D=20
true;<BR>&nbsp;&nbsp;}<BR>}&nbsp;</FONT></P>
<P><FONT face=3DArial>This is what I installed&nbsp;(all downloaded Nov =
9-10) in=20
the order I did it:</FONT></P><FONT size=3D2>
<P>pkgconfig-0.14.0</P>
<P>glib-2.0.7</P>
<P>pango-1.0.5</P>
<P>atk-1.0.3</P>
<P>libxml2-2.4.26</P>
<P>gtk+-2.0.8</P>
<P>mono-0.16</P>
<P>gtk-sharp-0.5</P>
<P>I'm running a SuSE 8 Linux System, the above installation also =
required some=20
packages which I installed from SuSE like =
gcc,libtool,autoconf,bison,X11,=20
etc</P>
<P>Any help I'd appreciate, I have a mono conference tomorrow and I just =
want to=20
run a simple graphic example to demonstrate mono.</P>
<P>Thanks</P>
<P>Fabian</P></FONT></FONT></FONT></FONT></DIV></BODY></HTML>

------=_NextPart_000_000E_01C28976.86D16010--