[Gtk-sharp-list] Gnome.CanvasWidget possible bug

Paulo Pires paulo.pires@vodafone.pt
Fri, 04 Mar 2005 14:18:26 +0000


--=-4jLYuqswsNRh3C0zcSkZ
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi fellows

I've done this simple test in order to help knowing if this is a bug or
just lammeness :)

The problem is that Gnome.CanvasWidgetshould be appearing on the
Gnome.Canvas and it isn't.

I'd love to know how to add an Gnome.CanvasItem to the upper-left corner
of the canvas, since I'm unable to get it in my tests with
Gnome.CanvasPixbuf.

I'm using Mono 1.1.4 and latest gtk-sharp svn revision.
I've compilled and ran the test as follows:
mcs -pkg:gtk-sharp,gnome-sharp test.cs
mono test.exe

Thanks in advance,
Paulo Pires

--=-4jLYuqswsNRh3C0zcSkZ
Content-Disposition: attachment; filename=test.cs
Content-Type: text/x-csharp; name=test.cs; charset=us-ascii
Content-Transfer-Encoding: 7bit

using System;
using Gtk;

public class CreatedWindow : Window
{
	private Button butAddWidget;
	private Gnome.Canvas canvas;
	
	public CreatedWindow () : base ("Test Canvas")
	{
		butAddWidget = new Button(Stock.Add);
		butAddWidget.Clicked += OnbutAddWidgetClicked;
		
		canvas = new Gnome.Canvas();
		canvas.SetSizeRequest(400, 400);
		
		VBox v = new VBox();
		v.PackStart(butAddWidget, false, false, 0);
		v.PackStart(canvas, false, false, 0);
		
		this.Add(v);
		this.DeleteEvent += OnWindowDelete;
		this.ShowAll();
	}
	
	
	private void OnbutAddWidgetClicked (object o, EventArgs args)
	{
		AddWidget();
	}
	

	private void OnWindowDelete (object o, DeleteEventArgs args)
	{
		Application.Quit();
	}
	
	private void AddWidget()
	{
		VBox v = new VBox();
		v.PackStart(new Label("Testing label"), false, false,0);
		v.PackStart(new Button("Testing button"), false, false,0);
		
		Gnome.CanvasWidget canvas_widget = new Gnome.CanvasWidget(canvas.Root());
		canvas_widget.Widget = v;
		canvas_widget.Show(); // I don't really know if this is needed. With Gnome.CanvasPixbuf it isn't
	}
}

public class test
{
	public static void Main()
	{
		Application.Init();
		new CreatedWindow();
		Application.Run();
	}
}

--=-4jLYuqswsNRh3C0zcSkZ--