How do I set the default color for objects created by the canvas

classic Classic list List threaded Threaded
3 messages Options
HJH
Reply | Threaded
Open this post in threaded view
|

How do I set the default color for objects created by the canvas

HJH
Hello

I have two squares.

     | canvas    |
     canvas := DrGeoCanvas new.

     canvas polygon: {0@0 . 0@10 . 10@10 . 10@0}.
     canvas polygon: {5@5 . 5@15 . 15@15 . 15@5}.

Two blue squares created by the #polygon: method

I would like to have the second square to be in a different color.

How do I do that?

Having a look at the class which implements #polygon: did not reveal a solution.

--Hannes
Reply | Threaded
Open this post in threaded view
|

Re: How do I set the default color for objects created by the canvas

Hilaire Fernandes
Administrator
Le 06/09/2018 à 15:57, HJH [via Dr. Geo Forum] a écrit :
>    canvas polygon: {5@5 . 5@15 . 15@15 . 15@5}.
>
>
> I would like to have the second square to be in a different color.
>

Hi,

(canvas polygon: {5@5 . 5@15 . 15@15 . 15@5}) color: Color red

or

item := canvas polygon: {5@5 . 5@15 . 15@15 . 15@5}.
item color: Color red

> Having a look at the class which implements #polygon: did not reveal a
> solution.

You need to look a the DrGWrappedItem hierarchy.

You can take a look at the user guide in English, in the Smalltalk
Figure section.

Hilaire

Was this message helpful?
Tell us!
HJH
Reply | Threaded
Open this post in threaded view
|

Re: How do I set the default color for objects created by the canvas

HJH
This worked fine, thank you.


--Hannes

Setting the color of a DrGeo object with Smalltalk