[Mono-list] fail to compite *.exe

Stephen Liu satimis at yahoo.com
Fri Apr 23 09:56:36 EDT 2010


Hi Alexander,


Following the document
http://www.mono-project.com/GtkSharpBeginnersGuide
For example, to use the event Gdk.Event, we could use something like this: 

I copied;

using Gdk;
    ...
    widget.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressHandler);
    ...
    private void ButtonPressHandler(object obj, ButtonPressEventArgs args) {
        // single click
        if (args.Event.Type == EventType.ButtonPress) {
            ...
        }
        // double click
        if (args.Event.Type == EventType.TwoButtonPress) {
            ...
        }
        
        // the left button was used
        if (args.Event.Button == 1) {
            ...
        }
    }

- end -

to the bottom of helloworld.cs and edited the file.

Now the file looks

$ cat helloword.cs
 using System;
 using Gtk;
 using Gdk;
 
 public class GtkHelloWorld {
  
   public static void Main() {
     Application.Init();
 
     //Create the Window
     Window myWin = new Window("My first GTK# Application! ");
     myWin.Resize(200,200);
     
     //Create a label and put some text in it.     
     Label myLabel = new Label();
     myLabel.Text = "Hello World!!!!";
          
     //Add the label to the form     
     myWin.Add(myLabel);
     
     //Show Everything     
     myWin.ShowAll();
     
     Application.Run();   
   }
 }
    widget.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressHandler);

    private void ButtonPressHandler(object obj, ButtonPressEventArgs args) {
        // single click
        if (args.Event.Type == EventType.ButtonPress) {
        }
        // double click
        if (args.Event.Type == EventType.TwoButtonPress) {
        }
        // the left button was used
        if (args.Event.Button == 1) {
        }
    }
- end -


The problem is on line 27,30);

widget.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressHandler);

I suppose "30" is the position, counting from left.

I have no idea how to change "+="

I tried "==" without result.


Please help.  TIA


B.R.
Stephen L



----- Original Message ----
From: Alexander Shulgin <alexander.shulgin at yessoftware.com>
To: mono-list at lists.ximian.com
Sent: Fri, April 23, 2010 6:04:49 AM
Subject: Re: [Mono-list] fail to compite *.exe

On 23.04.2010 16:02, Stephen Liu wrote:
> Hi Robert,
>
> Thanks for your advice.
>
> $ gmcs -pkg:gtk-sharp-2.0 helloword.cs -debug
> helloword.cs(27,5): error CS8025: Parsing error
> Compilation failed: 1 error(s), 0 warnings

You need to take a close look at line 27 in your helloword.cs
_______________________________________________
Mono-list maillist  -  Mono-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list





More information about the Mono-list mailing list