Re: Coding question, canvas




> Would this be solved better by creating my own canvas item or by
> grouping lines and rectangles and other native canvas items?

I suggest you use the existing canvas items for that.

> When do you genereally need to create your own items?

There are a number of times, here is a small list of things that occur 
to me that would be candidates for being custom items:

	- When the canvas does not provide an item that does what you
	  need (Gnumeric implements a "Cursor" item which is a
	  specialized item that can can be animated and knows about
	  the sheet internals).

	- When you only want the canvas as an anti-flicker display
	  engine (or if you want to mix with other items).
	  Gnumeric's sheet display is an example of this.

	- When you have way too much information to display
	  efficiently by creating an item per object (for example, if
	  you need to display a plot or an image, you migth benefit
	  from a specialized item.

	- If the canvas has no support for your favorite item type.

The existing canvas items are pretty powerful already, if you can use
those, you could save a lot of time. 

> One more question... maybe a silly one. How do I get just a single
> point on the canvas? I can make lines, arrows, rectangles, arrows, etc,
> but not a small point. I tried to draw a line from one point to the
> same but it's "too short" too be seen...

I would create a really small rectangle :-)


-- 
miguel@gnu.org



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]