Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add instances of the Button to the form dynamically in monodevelop

I use MonoDevelop 2.4.2.1 on WinXP. I have a window with VBox and button 'MyButton'. Now I should write a method for 'MyButton' for creating other Button's instances dinamically. I can't understand how to handle containers and widgets. Please give me advice how to do this.

Thanx!

like image 947
Trom Avatar asked Jan 28 '26 16:01

Trom


1 Answers

You'll need to do something like:

myButton.Clicked += delegate {
    var nextButton = new Button ("Hello");
    box.PackEnd (nextButton, false, false, 0);
};

You can find GTK# tutorials at http://www.mono-project.com/GtkSharpTutorials and at http://zetcode.com/tutorials/gtksharptutorial/

In particular, I would suggest you read http://www.mono-project.com/GtkSharp:_Widget_Layout_and_Packing

like image 110
Mikayla Hutchinson Avatar answered Jan 30 '26 06:01

Mikayla Hutchinson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!