[Gtk-sharp-list] GnomeCanvas questions

Owen Fraser-Green owen@discobabe.net
Thu, 29 Apr 2004 16:57:43 +0200


Hi,

The other constructor is protected and exists only to help subclasses
derived from CanvasGroup. It's protected because otherwise people would
be able to write, for example:

CanvasGroup group = new CanvasGroup(canvas.Root(),CanvasText.GType); 

Since no-one else has complained, I've committed the patch.

Cheers,
Owen

On Thu, 2004-04-29 at 16:31, Jorge García wrote:
> Ciao,
> 
> it works for me, but I think the other constructor must work too. Maybe
> I'm missing anything but I don't know what ...
> 
> CanvasGroup group = new CanvasGroup(canvas.Root(),CanvasGroup.GType); 
> 
> ui.cs(231) error CS1501: No overload for method `Gnome.CanvasGroup'
> takes `2' arguments
> 
> Thaks,
> 
> Jorge
> 
> 
> 
> 
> 
> 
> On dc, 2004-04-28 at 16:56, Owen Fraser-Green wrote:
> > Hi,
> > 
> > There's a public constructor missing from CanvasGroup. The attached
> > patch adds one so you can do, for example:
> > 
> > CanvasGroup group = new CanvasGroup(canvas.Root());
> > 
> > OK to commit?
> > 
> > Cheers,
> > Owen
> > 
> > On Mon, 2004-04-26 at 19:41, Jorge García wrote:
> > > Hi,
> > > 
> > > does someone know how is the best method for declare a CanvasGroup?
> > > 
> > > With this sentence I get the following error:
> > > CanvasGroup group = new CanvasGroup(canvas.Root(),CanvasGroup.GType);		
> > > 
> > > ui.cs(196) error CS1501: No overload for method `Gnome.CanvasGroup'
> > > takes `2' arguments
> > > 
> > > But if I make like samples/Fifteen.cs example and I define a subclass of
> > > CanvasGroup then it works:
> > > 
> > > MyGroup group = new MyGroup(canvas.Root());
> > > 
> > > ...
> > > 
> > > public class MyGroup: Gnome.CanvasGroup{
> > > 		public MyGroup (CanvasGroup group)
> > > 			: base (group, CanvasGroup.GType)
> > > 			{
> > > 				
> > > 			}
> > > }
> > > 
> > > 
> > > 
> > > Another question that I have is how to write lines fast. I use this
> > > function (ported from George Lebl's DeveloperWorks article):
> > > 
> > > void DrawALine(CanvasGroup group,double x1, double y1, double x2, double
> > > y2, string color){
> > > 
> > > 	double[] coords = {x1, y1, x2, y2};
> > > 	/* allocate a new points array */
> > > 	CanvasPoints points = new CanvasPoints(coords);
> > > 
> > > 	/* draw the line */
> > > 	CanvasLine item = new CanvasLine(group);
> > > 	item.Points = points;
> > > 	item.FillColor = color;
> > > 	item.WidthUnits = 1.0;
> > > 	item.CanvasEvent += new Gnome.CanvasEventHandler (Item_Event);
> > > }
> > > 
> > > The problem with this function is that each time that it calls to
> > > "new CanvasPoints(coords)" the coordinates are showed by the console,
> > > and its makes veeeery slow my program (that uses thousands of lines)
> > > 
> > > 
> > > Thank you very much in advance,
> > > 
> > > Jorge
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> > > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list