RE: [Newbies] Project on squeak language

2016-08-20 Thread Ron Teitelbaum
 

 

From: roger mpouma
Sent: Saturday, August 20, 2016 2:42 PM



 

How can i make  this please ?

I thought to add "color" and "size" commands as "clear" command in the custom 
menu code. After that, add "color" and "size" methods...

[Ron Teitelbaum] 

What I was thinking is making buttons on the panel. Color buttons with a 
highlight around it so you can see what is selected.  You could instead add 
something like Red or Blue to the menu.

 

On your class add some instance variable called drawColor or something like 
that.

 

When the menu item Red is called you would do 

 

drawColor := Color red.

 

Then in mouseDown:

 

brush color: drawColor.

 

Initialize your color to something like black

 

Initialize

 

   drawColor := Color black.

 

So that the user is not required to use the menu to get the default color 
(black).

 

Hope that helps,


Ron

 

2016-08-20 20:26 GMT+02:00 Ron Teitelbaum :

Have you considered having a menu bar with colors and line sizes.  The users 
can select the color and line size which will change your program to use those 
settings.

 

All the best,

 

Ron Teitelbaum

 

From: beginners-boun...@lists.squeakfoundation.org 
[mailto:beginners-boun...@lists.squeakfoundation.org] On Behalf Of roger mpouma
Sent: Saturday, August 20, 2016 1:51 PM
To: A friendly place to get answers to even the most basic questions about 
Squeak.
Subject: Re: [Newbies] Project on squeak language

 

I have already implemented the canvas on which we draw, the possibility of 
drawing with the brush but with only a single color and a single size, a 
capacity to erase what we have already drawn with the "Clear" command on the 
custom menu code. 
So, i'd like to add the possibility of changing the color and the size of the 
brush presenting the choices of color and brush size.

The differents methods are:

"Methods"

extent: aPoint
| newForm |
super extent: aPoint.
newForm := Form extent: self extent depth: 16.
newForm fillColor: Color veryLightGray.
form ifNotNil: [form displayOn: newForm].
form := newForm.
 
 
initialize
super initialize.
self extent: 500@350.
 
drawOn: aCanvas
aCanvas image: form at: bounds origin.
 
handlesMouseDown: evt
^ true 
 
mouseDown: evt
brush := Pen newOnForm: form.
brush roundNib: 3.
brush color: Color red.
lastMouse := evt cursorPoint - bounds origin.
brush drawFrom: lastMouse to: lastMouse.
self invalidRect:
((lastMouse - brush sourceForm extent corner:
lastMouse + brush sourceForm extent)
translateBy: bounds origin).
 
 
mouseMove: evt
| p |
p := evt cursorPoint - bounds origin.
p = lastMouse ifTrue: [^ self].
 brush drawFrom: lastMouse to: p.
self invalidRect: ((
((lastMouse min: p) - brush sourceForm extent) corner:
((lastMouse max: p) + brush sourceForm extent))
translateBy: bounds origin).
lastMouse := p.
 
 
addCustomMenuItems: aCustomMenu hand: aHandMorph
super addCustomMenuItems: aCustomMenu hand: aHandMorph.
aCustomMenu add: 'clear' action: #clear.
 
 
clear
form fillColor: Color veryLightGray.
self changed.

"Class PaintMorph"

Morph subclass: #PaintMorph
instanceVariableNames: 'form brush lastMouse'
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-Fun'

"Workspace"
PaintMorph new openInWorld.

 

Thank you in advance.

 

2016-08-20 18:47 GMT+02:00 Bert Freudenberg :

Sure. Just ask some specific questions - e.g. what you tried, what worked, what 
didn't etc.

 

- Bert -

 

On Sat, Aug 20, 2016 at 10:59 AM, roger mpouma  wrote:

Hello, 
I need help for a drawing project on Squeak. I'd like implement a canvas on 
which we draw with the possibility of drawing with brush changing the color and 
size of the brush. Is it possibile to have help ?

Thank you in advance. 

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

 


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

 


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

 

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Project on squeak language

2016-08-20 Thread roger mpouma
How can i make  this please ?
I thought to add "color" and "size" commands as "clear" command in the
custom menu code. After that, add "color" and "size" methods...

2016-08-20 20:26 GMT+02:00 Ron Teitelbaum :

> Have you considered having a menu bar with colors and line sizes.  The
> users can select the color and line size which will change your program to
> use those settings.
>
>
>
> All the best,
>
>
>
> Ron Teitelbaum
>
>
>
> *From:* beginners-boun...@lists.squeakfoundation.org [mailto:
> beginners-boun...@lists.squeakfoundation.org] *On Behalf Of *roger mpouma
> *Sent:* Saturday, August 20, 2016 1:51 PM
> *To:* A friendly place to get answers to even the most basic questions
> about Squeak.
> *Subject:* Re: [Newbies] Project on squeak language
>
>
>
> I have already implemented the canvas on which we draw, the possibility of
> drawing with the brush but with only a single color and a single size, a
> capacity to erase what we have already drawn with the "Clear" command on
> the custom menu code.
> So, i'd like to add the possibility of changing the color and the size of
> the brush presenting the choices of color and brush size.
>
> The differents methods are:
>
> "Methods"
>
> extent: aPoint
> | newForm |
> super extent: aPoint.
> newForm := Form extent: self extent depth: 16.
> newForm fillColor: Color veryLightGray.
> form ifNotNil: [form displayOn: newForm].
> form := newForm.
>
>
> initialize
> super initialize.
> self extent: 500@350.
>
> drawOn: aCanvas
> aCanvas image: form at: bounds origin.
>
> handlesMouseDown: evt
> ^ true
>
> mouseDown: evt
> brush := Pen newOnForm: form.
> brush roundNib: 3.
> brush color: Color red.
> lastMouse := evt cursorPoint - bounds origin.
> brush drawFrom: lastMouse to: lastMouse.
> self invalidRect:
> ((lastMouse - brush sourceForm extent corner:
> lastMouse + brush sourceForm extent)
> translateBy: bounds origin).
>
>
> mouseMove: evt
> | p |
> p := evt cursorPoint - bounds origin.
> p = lastMouse ifTrue: [^ self].
>  brush drawFrom: lastMouse to: p.
> self invalidRect: ((
> ((lastMouse min: p) - brush sourceForm extent) corner:
> ((lastMouse max: p) + brush sourceForm extent))
> translateBy: bounds origin).
> lastMouse := p.
>
>
> addCustomMenuItems: aCustomMenu hand: aHandMorph
> super addCustomMenuItems: aCustomMenu hand: aHandMorph.
> aCustomMenu add: 'clear' action: #clear.
>
>
> clear
> form fillColor: Color veryLightGray.
> self changed.
>
> "Class PaintMorph"
>
> Morph subclass: #PaintMorph
> instanceVariableNames: 'form brush lastMouse'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Morphic-Fun'
>
> "Workspace"
> PaintMorph new openInWorld.
>
>
>
> Thank you in advance.
>
>
>
> 2016-08-20 18:47 GMT+02:00 Bert Freudenberg :
>
> Sure. Just ask some specific questions - e.g. what you tried, what worked,
> what didn't etc.
>
>
>
> - Bert -
>
>
>
> On Sat, Aug 20, 2016 at 10:59 AM, roger mpouma  wrote:
>
> Hello,
> I need help for a drawing project on Squeak. I'd like implement a canvas
> on which we draw with the possibility of drawing with brush changing the
> color and size of the brush. Is it possibile to have help ?
>
> Thank you in advance.
>
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
>
>
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
>
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


RE: [Newbies] Project on squeak language

2016-08-20 Thread Ron Teitelbaum
Have you considered having a menu bar with colors and line sizes.  The users 
can select the color and line size which will change your program to use those 
settings.

 

All the best,

 

Ron Teitelbaum

 

From: beginners-boun...@lists.squeakfoundation.org 
[mailto:beginners-boun...@lists.squeakfoundation.org] On Behalf Of roger mpouma
Sent: Saturday, August 20, 2016 1:51 PM
To: A friendly place to get answers to even the most basic questions about 
Squeak.
Subject: Re: [Newbies] Project on squeak language

 

I have already implemented the canvas on which we draw, the possibility of 
drawing with the brush but with only a single color and a single size, a 
capacity to erase what we have already drawn with the "Clear" command on the 
custom menu code. 
So, i'd like to add the possibility of changing the color and the size of the 
brush presenting the choices of color and brush size.

The differents methods are:

"Methods"

extent: aPoint
| newForm |
super extent: aPoint.
newForm := Form extent: self extent depth: 16.
newForm fillColor: Color veryLightGray.
form ifNotNil: [form displayOn: newForm].
form := newForm.
 
 
initialize
super initialize.
self extent: 500@350.
 
drawOn: aCanvas
aCanvas image: form at: bounds origin.
 
handlesMouseDown: evt
^ true 
 
mouseDown: evt
brush := Pen newOnForm: form.
brush roundNib: 3.
brush color: Color red.
lastMouse := evt cursorPoint - bounds origin.
brush drawFrom: lastMouse to: lastMouse.
self invalidRect:
((lastMouse - brush sourceForm extent corner:
lastMouse + brush sourceForm extent)
translateBy: bounds origin).
 
 
mouseMove: evt
| p |
p := evt cursorPoint - bounds origin.
p = lastMouse ifTrue: [^ self].
 brush drawFrom: lastMouse to: p.
self invalidRect: ((
((lastMouse min: p) - brush sourceForm extent) corner:
((lastMouse max: p) + brush sourceForm extent))
translateBy: bounds origin).
lastMouse := p.
 
 
addCustomMenuItems: aCustomMenu hand: aHandMorph
super addCustomMenuItems: aCustomMenu hand: aHandMorph.
aCustomMenu add: 'clear' action: #clear.
 
 
clear
form fillColor: Color veryLightGray.
self changed.

"Class PaintMorph"

Morph subclass: #PaintMorph
instanceVariableNames: 'form brush lastMouse'
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-Fun'

"Workspace"
PaintMorph new openInWorld.

 

Thank you in advance.

 

2016-08-20 18:47 GMT+02:00 Bert Freudenberg :

Sure. Just ask some specific questions - e.g. what you tried, what worked, what 
didn't etc.

 

- Bert -

 

On Sat, Aug 20, 2016 at 10:59 AM, roger mpouma  wrote:

Hello, 
I need help for a drawing project on Squeak. I'd like implement a canvas on 
which we draw with the possibility of drawing with brush changing the color and 
size of the brush. Is it possibile to have help ?

Thank you in advance. 

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

 


___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

 

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Project on squeak language

2016-08-20 Thread roger mpouma
I have already implemented the canvas on which we draw, the possibility of
drawing with the brush but with only a single color and a single size, a
capacity to erase what we have already drawn with the "Clear" command on
the custom menu code.
So, i'd like to add the possibility of changing the color and the size of
the brush presenting the choices of color and brush size.

The differents methods are:

"Methods"
extent: aPoint
| newForm |
super extent: aPoint.
newForm := Form extent: self extent depth: 16.
newForm fillColor: Color veryLightGray.
form ifNotNil: [form displayOn: newForm].
form := newForm.


initialize
super initialize.
self extent: 500@350.

drawOn: aCanvas
aCanvas image: form at: bounds origin.

handlesMouseDown: evt
^ true

mouseDown: evt
brush := Pen newOnForm: form.
brush roundNib: 3.
brush color: Color red.
lastMouse := evt cursorPoint - bounds origin.
brush drawFrom: lastMouse to: lastMouse.
self invalidRect:
((lastMouse - brush sourceForm extent corner:
lastMouse + brush sourceForm extent)
translateBy: bounds origin).


mouseMove: evt
| p |
p := evt cursorPoint - bounds origin.
p = lastMouse ifTrue: [^ self].
 brush drawFrom: lastMouse to: p.
self invalidRect: ((
((lastMouse min: p) - brush sourceForm extent) corner:
((lastMouse max: p) + brush sourceForm extent))
translateBy: bounds origin).
lastMouse := p.


addCustomMenuItems: aCustomMenu hand: aHandMorph
super addCustomMenuItems: aCustomMenu hand: aHandMorph.
aCustomMenu add: 'clear' action: #clear.


clear
form fillColor: Color veryLightGray.
self changed.

"Class PaintMorph"
Morph subclass: #PaintMorph
instanceVariableNames: 'form brush lastMouse'
classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-Fun'

"Workspace"
PaintMorph new openInWorld.


Thank you in advance.

2016-08-20 18:47 GMT+02:00 Bert Freudenberg :

> Sure. Just ask some specific questions - e.g. what you tried, what worked,
> what didn't etc.
>
> - Bert -
>
> On Sat, Aug 20, 2016 at 10:59 AM, roger mpouma  wrote:
>
>> Hello,
>> I need help for a drawing project on Squeak. I'd like implement a canvas
>> on which we draw with the possibility of drawing with brush changing the
>> color and size of the brush. Is it possibile to have help ?
>>
>> Thank you in advance.
>> ___
>> Beginners mailing list
>> Beginners@lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>>
>
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


Re: [Newbies] Project on squeak language

2016-08-20 Thread Bert Freudenberg
Sure. Just ask some specific questions - e.g. what you tried, what worked,
what didn't etc.

- Bert -

On Sat, Aug 20, 2016 at 10:59 AM, roger mpouma  wrote:

> Hello,
> I need help for a drawing project on Squeak. I'd like implement a canvas
> on which we draw with the possibility of drawing with brush changing the
> color and size of the brush. Is it possibile to have help ?
>
> Thank you in advance.
> ___
> Beginners mailing list
> Beginners@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Project on squeak language

2016-08-20 Thread roger mpouma
Hello,
I need help for a drawing project on Squeak. I'd like implement a canvas on
which we draw with the possibility of drawing with brush changing the color
and size of the brush. Is it possibile to have help ?

Thank you in advance.
___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners