[MonoDevelop] Running Mono with Glade ..... ERROR

John Luke jluke@users.sourceforge.net
Wed, 14 Apr 2004 17:11:02 -0400


Your glade file has:
on_button1_clicked
not:
onButtonClicked 

as you have it in your code.  It has to be the exact name for it to
work. So either change the glade file to match your code or vice-versa.

On Wed, 2004-04-14 at 21:48 +0100, Paulo Aboim Pinto wrote:
> Hello
> 
> tkx for your response.
> 
> I had try to find if i have this kind of error, but no.
> 
> i will paste here my file for you to try to undestand what is happening:
> 
> .glade file
> 
> [...]
> <child>
>                     <widget class="GtkButton" id="button1">
>                       <property name="width_request">62</property>
>                       <property name="height_request">31</property>
>                       <property name="visible">True</property>
>                       <property name="can_focus">True</property>
>                       <property name="label"
> translatable="yes">button1</property>
>                       <property name="use_underline">True</property>
>                       <property
> name="relief">GTK_RELIEF_NORMAL</property>
>                       <signal name="clicked"
> handler="on_button1_clicked" last_modification_time="Wed, 14 Apr 2004
> 20:35:51 GMT"/>
>                     </widget>
>                     <packing>
>                       <property name="x">224</property>
>                       <property name="y">56</property>
>                     </packing>
>                   </child>
> [...]
> 
> 
> .cs file
> namespace GladeSamples 
> {
> 	using System;
>     using Gtk;
> 	using Glade;
>    	using GtkSharp;
> 
>     public class GladeTest
>     {
>         public static void Main (string[] args)
>         {
>             new GladeTest(args);
>         }
>         
>         public GladeTest (string[] args) 
>         {
>             Application.Init();
>             XML gxml = new Glade.XML ("project1.glade", "window1",
> null);    
> 		try
>            	{
>            		gxml.Autoconnect (this);
>            		window1.showall();
>             		Application.Run();
>            	}
>            	catch (Exception ex)
>        		{
>         		Console.WriteLine ("Erro in main \n\n{0}", ex);
>         	}
>         }
>         
>         public void onButtonClicked (System.Object obj, EventArgs e) 
>         {
>         	Console.writeline("Button clicked");
>         }
>     }
> }
> 
> as you can see i have the same handler in glade file and CS file.
> But i get this error even without the definition in the CS file. Only
> have the signal definned in the glade file i get the error.
> 
> Can any one help ???
> 
> 
> On Wed, 2004-04-14 at 17:47, Laurent Guisset wrote:
> > I think that the name of the method in the .cs file and the
> > name of the handler in the .glade file must be the same, this is
> > required by the Autoconnect method.
> > 
> > Example :
> > *********
> > 
> > 
> > .glade file
> > *************
> > 
> > ...
> > <signal name="clicked" handler="*OnButtonClicked*" 
> > last_modification_time="Wed, 14 Apr 2004 09:11:35 GMT"/>
> > ...
> > 
> > 
> > 
> > .cs file
> > ********
> > 
> > public void *OnButtonClicked* (System.Object obj, EventArgs e)
> > {
> >     Console.WriteLine ("Button 1 clicked");
> > }
> > 
> > _______________________________________________
> > Monodevelop-list mailing list
> > Monodevelop-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/monodevelop-list
> -- 
> 
> Paulo Aboim Pinto
> Odivelas - Portugal