[MonoDevelop] Can't get basic code to work

George Lober georgelober at glowsoftware.ca
Wed Jul 25 22:55:46 EDT 2007


Looks like the problem was with using the right signal. Using the 
Clicked event and my original steps is working now. One thing that I was 
doing which is different from the steps that you outline is that I was 
entering the event name manually in the signals column (the fields do 
say to "Click here to add a new handler") as opposed to double clicking 
twice on the signal name itself, but this does not appear to make a 
difference, it is the Clicked signal that was needed. I do prefer the 
double click approach thou, so thank you for pointing that out.


Thank you for your help,
George



Sergio Hernandez wrote:
>
> 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
>



More information about the Monodevelop-list mailing list