[Balloon] questions

Baveco, Hans Hans.Baveco at wur.nl
Wed Oct 26 13:37:56 UTC 2005


In my clumsy attempts at displaying circles, squares, polygons and text
on a (Balloon) Canvas, I keep running into strange behavior that to me
looks like canvas properties that are sometime updated and sometimes
not, and sometimes not even set at all...
Maybe this is systematic, but currently I am lost how to achieve my
relatively simple goal.

(in a previous post I mixed
#drawRectangle:color:borderWidth:borderColor: with
#fillOval:color:borderWidth:borderColor: and the resulting colors were
not what I suspected. For some reason (why?) mixing these type of
methods is an unusual thing to do...)

Current problems:
1)
Using drawOval:etc instead of fillOval:etc results in circles with
correct colors.
However, mixing circles and squares with text (using
drawString:at:font:color:) results again in strange interference
effects. See the code below. Displaying the string on another canvas is
ok; displaying the string on the same canvas distorts the following
display of rectangles and circles. 
Is drawString:at:font:color: a method of the #fillXXXX type, that should
not be mixed with #drawXXXX methods?? If so, how to draw String then?

2) 
Is drawOval:etc the best way to draw circles with borders? Under some
circumstances the borderColor doesnot appear (havent figured out exactly
when). And anyway the results are not that visually pleasing - so I
wondered whether there exist an alternative drawing method?

As I am not sure these things are bugs and not features so I'll wait
with posting them on Mantis.

Hans

| bc offset posRect count font bc2 |
	bc := BalloonCanvas on: Display.
	bc2 := BalloonCanvas on: Display.
	offset := 50 @ 50.
	posRect := -5 @ -5 extent: 11 @ 11.
	font := TextStyle defaultFont.
	count := 0.
	(Array with: bc2 with: bc) do: [:theBC | "when theBC == bc
strange things happen..."
	1 to: 2 do: [:i |
	theBC drawString: 'just a String' at: (offset + (count *
(50 at 0)))  font: font color: Color red.
	{ (Color red). (Color blue). (Color yellow). (Color green) } do:

				[:each | 
				count := count + 1.
				bc 
					drawRectangle: (posRect
translateBy: (offset x * count) @ 10)
					color: each
					borderWidth: 1
					borderColor: Color black.
				bc 
					drawOval: (posRect translateBy:
(offset x * count) @ 30)
					color: each
					borderWidth: 1
					borderColor: "each "Color
black]] ]



More information about the Squeak-dev mailing list