[Gtk-sharp-list] Gtk, Glade question

gdillen guy.dillen at skynet.be
Wed Jul 19 05:27:16 EDT 2006


I suppose when using Glade (xml form files) and you want to manipulate the
properties of the Controls/widgets programmatically you have to create for
every control on your form an instance of the Gtk widget  (as in next code
snippet)?

Eg.
...
public class MainWindow
{
public Gtk.Window win;
public Gtk.Label label1;
public Gtk.Entry NaamEntry;

private Glade.XML xml;
		
public MainWindow()
{
win = (xml.GetWidget("frmMain") as Gtk.Window);
			
label1 = (xml.GetWidget("label1")as Gtk.Label);
NaamEntry = (xml.GetWidget("NaamEntry") as Gtk.Entry);
			
Gtk.Button OKButton = (xml.GetWidget("OKButton") as Gtk.Button);
OKButton.Clicked += new System.EventHandler(on_OKButton_clicked);
			
Gtk.MenuItem AfsluitenMenuItem = (xml.GetWidget("AfsluitenMenuItem") as
Gtk.MenuItem);
AfsluitenMenuItem.Activated += new
System.EventHandler(on_AfsluitenMenuItem_activate);			
}
		
public void on_OKButton_clicked(System.Object o, System.EventArgs args)
{	
if (label1 != null) label1.Text = "Button 1 clicked signal";
NaamEntry.Text = "xxx";		
}
...
-- 
View this message in context: http://www.nabble.com/Gtk%2C-Glade-question-tf1965215.html#a5392957
Sent from the Mono - Gtk# forum at Nabble.com.



More information about the Gtk-sharp-list mailing list