[Gtk-sharp-list] Scribble with Glade?

Sebastian Vorköper sv@fogman.de
Sat, 27 Mar 2004 22:02:44 +0100


Hello,

I'm trying to combine the Scribble.cs program with Glade.
In other words: I created a Glade-File with a window and a
Gtk.DrawingArea and did some coding on Scribble.cs to load and use that
stuff.

But it doesn't work.
I don't have any idea how to get it work, maybe someone in this list
does?
For me it seems that the Drawing Methods can't access the darea until
Application.Quit(); is run.
But than there will be no window and no drawing area.

A little code:

public class GladeTest{
  private static Gtk.DrawingArea darea;
  private static Gdk.Pixmap pixmap = null;
		
public static void Main (string[] args)
{
  new GladeTest(args);
}
		
public GladeTest (string[] args) 
{
  Glade.XML gxml;
  Application.Init ();
		
  gxml = new Glade.XML ("scribble.glade", "window1", null);
  gxml.Autoconnect (this);
  darea = (Gtk.DrawingArea)gxml.GetWidget("darea");
  darea.SetSizeRequest (200, 200);
			
  darea.ExposeEvent += new ExposeEventHandler (ExposeEvent);
  darea.ConfigureEvent += new ConfigureEventHandler (ConfigureEvent);
  darea.MotionNotifyEvent += new MotionNotifyEventHandler
(MotionNotifyEvent);
  darea.ButtonPressEvent += new ButtonPressEventHandler
(ButtonPressEvent);
  darea.Events = EventMask.ExposureMask | EventMask.LeaveNotifyMask |
EventMask.ButtonPressMask | EventMask.PointerMotionMask |
EventMask.PointerMotionHintMask;

  Application.Run ();
}

....
}

Thanks,
Sebastian Vorköper
sv@fogman.de