[Gtk-sharp-list] Scribble with Glade?

Moritz Angermann moritz.angermann@gmx.net
Sun, 28 Mar 2004 11:04:57 +0200


Hi, 
well I don't know the real reason why it does not work
your way.
But a few suggestions:
a) why not use Glade for signals/events?
b) why not use attributes?

to b) I'd do it like:

-----
Using System;
Using Glade;
Using Gtk;

public class foo{
	[Glade.Widget] DrawingArea darea; // darea is the widget name set in
Glade.
	[Glade.Widget] Pixmap pixmap; // again, pixmap is the widget name set
in Glade.

	public static void Main( string[] args )
	{
		new foo( args );
	}
	public foo( string[] args )
	{
		Application.Init( );
		Glade.XML gxml = new Glade.XML( "scribble.glade", "window1", null );
		gxml.Autoconnect( this );
		Application.Run( );
	}

	// Signal handlers - set in Glade
	on_window1_delete( object o, EventArgs args )
	{
		Application.Quit( );
	}
	// ... [...] ...
}
-----

kindest regards,
 -mo


On Sat, 2004-03-27 at 22:02, Sebastian Vorköper wrote:
> 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
> 
> 
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
-- 
----------------  contact info  ----------------
Moritz Angermann       	moritz.angermann@gmx.net
Liquid:Mint            	www.liquidmint.org
Mobile                 	+49 (0) 160 9197 5880
Home                   	+49 (0) 4322 75 12 66