[MonoDevelop] Can't get basic code to work

Sergio Hernandez hernandez.sergio.a at gmail.com
Wed Jul 25 19:27:27 EDT 2007


Looks like the compiler is not aware of the Clicked Signal and/or the Label & Entry widgets. Try the following:

1.- On Stetic you need to initialize the Clicked signal for the button1. On the Stetic designer, select the button on the <Widget Properties> go to the tab <Signals> (There are only two tabs, <Properties> & <Signals>).  Expand <Button Signals> and then select <Clicked>, then double click to initialize the Signal, and again double click to create the template:

protected virtual void OnButton1Clicked(object sender, System.EventArgs e){ }

On MainWindow.cs in the view Source Code (MainWindow.cs have two view <Source Code> & <Designer>). Here you can start coding.

2.- Probably you are not declaring the label1 & entry1 widgets. So you need to declare them as Gtk widgets right after the declaration of the public class and before the constructor:

public class MainWindow: Gtk.Window
{	
	Label label1; // or Gtk.Label 
	Entry entry1; // or Gtk.Entry
	public MainWindow (): base ("")
	{

On Wednesday 25 July 2007 13:23:36 George Lober wrote:
> Hello,
>
> Sorry if this seems a bit idiotic guys but I can't even get through the
> basic stuff.
>
> Using MonoDevelop/Stetic, I just have a basic window with a button,
> label and entry widgets. I have the following attached to the button
> buttonPressEvent:
>
>     protected virtual void onButtonPress (object o,
> Gtk.ButtonPressEventArgs args)
>     {
>         label1.Text = "abcd";
>         entry1.Text = "1234";
>     }
>
> and this attached to the button Activated signal:
>
>     protected virtual void onActivated (object sender, System.EventArgs e)
>     {
>         label1.Text = "abcd";
>         entry1.Text = "1234";
>     }
>
> When I run the app and click on the button, neither one of these is
> working, the text does not show up in the label or the entry box. What
> am I missing?
>
>
> Thanks,
> George
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodevelop-list/attachments/20070725/8d1085ee/attachment-0001.html 


More information about the Monodevelop-list mailing list