<div dir="ltr"><div><div><div>I modified methods:<span class="im"><br><br>addCustomMenuItems: aCustomMenu hand: aHandMorph<br>    super addCustomMenuItems: aCustomMenu hand:  aHandMorph.</span><span class="im"><br>    aCustomMenu add: &#39;clear&#39; action: #clear.<br></span>    drawColor := Color red.                    //modification<br>    drawColor := Color yellow.                //modification<br>    drawColor := Color green.                 //modification<br>    drawColor := Color blue.                   //modification<br><br>initialize<br>    super initialize.<br>    self extent: 500@700.<br>    drawColor := Color black.<span class="im"><br><br>mouseDown: evt<br>    brush := Pen newOnForm: form.<br></span>    brush roundNib: 2.<br>    brush color: drawColor.                                    //modification<span class="im"><br>    lastMouse := evt cursorPoint - bounds origin.<br>    brush drawFrom: lastMouse to: lastMouse.<br>    self invalidRect:<br>    ((lastMouse - brush sourceForm extent corner:<br>    lastMouse + brush sourceForm extent)<br>    translateBy: bounds origin).<br><br><br></span></div><div>The initial color is black.<br></div>When
 i click the command &quot;change color&quot; on the menu  and i chose for example
 the green color, the result is the blue color. I don&#39;t understand why ?<br></div>And
 after the first choice, i must restart the program with the Workspace 
for change another color. So i can&#39;t make several choices at the same 
time.<br><br>How can I solve these problems ? and to change size of the brush ? <br><br></div>Thank you in advance.</div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-21 3:14 GMT+02:00 Ron Teitelbaum <span dir="ltr">&lt;<a href="mailto:ron@usmedrec.com" target="_blank">ron@usmedrec.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> roger mpouma<br><b>Sent:</b> Saturday, August 20, 2016 2:42 PM<br><br><u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><div><span class=""><div><p class="MsoNormal">How can i make  this please ?<u></u><u></u></p></div><p class="MsoNormal">I thought to add &quot;color&quot; and &quot;size&quot; commands as &quot;clear&quot; command in the custom menu code. After that, add &quot;color&quot; and &quot;size&quot; methods...<u></u><u></u></p></span><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">[Ron Teitelbaum] <u></u><u></u></span></i></b></p><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">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.<u></u><u></u></span></i></b></p><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></i></b></p><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">On your class add some instance variable called drawColor or something like that.<u></u><u></u></span></i></b></p><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></i></b></p><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">When the menu item Red is called you would do <u></u><u></u></span></i></b></p><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></i></b></p><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">drawColor := Color red.<u></u><u></u></span></i></b></p><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></i></b></p><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Then in mouseDown:<u></u><u></u></span></i></b></p><p class="MsoNormal"><b><i><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></i></b></p><p class="MsoNormal">    brush color: drawColor.<b><i><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u><u></u></span></i></b></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Initialize your color to something like black<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Initialize<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">               drawColor := Color black.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">So that the user is not required to use the menu to get the default color (black).<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hope that helps,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><br>Ron<u></u><u></u></span></p></div><div><div class="h5"><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">2016-08-20 20:26 GMT+02:00 Ron Teitelbaum &lt;<a href="mailto:ron@usmedrec.com" target="_blank">ron@usmedrec.com</a>&gt;:<u></u><u></u></p><div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">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.</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">All the best,</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Ron Teitelbaum</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a href="mailto:beginners-bounces@lists.squeakfoundation.org" target="_blank">beginners-bounces@lists.<wbr>squeakfoundation.org</a> [mailto:<a href="mailto:beginners-bounces@lists.squeakfoundation.org" target="_blank">beginners-bounces@<wbr>lists.squeakfoundation.org</a>] <b>On Behalf Of </b>roger mpouma<br><b>Sent:</b> Saturday, August 20, 2016 1:51 PM<br><b>To:</b> A friendly place to get answers to even the most basic questions about Squeak.<br><b>Subject:</b> Re: [Newbies] Project on squeak language</span><u></u><u></u></p><div><div><p class="MsoNormal"> <u></u><u></u></p><div><div><div><p class="MsoNormal" style="margin-bottom:12.0pt">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 &quot;Clear&quot; command on the custom menu code. <br>So, i&#39;d like to add the possibility of changing the color and the size of the brush presenting the choices of color and brush size.<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">The differents methods are:<u></u><u></u></p></div><div><p class="MsoNormal">&quot;Methods&quot;<u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">extent: aPoint<br>    | newForm |<br>    super extent: aPoint.<br>    newForm := Form extent: self extent depth: 16.<br>    newForm fillColor: Color veryLightGray.<br>    form ifNotNil: [form displayOn: newForm].<br>    form := newForm.<br>     <br>     <br>initialize<br>    super initialize.<br>    self extent: 500@350.<br>     <br>drawOn: aCanvas<br>    aCanvas image: form at: bounds origin.<br>     <br>handlesMouseDown: evt<br>    ^ true     <br>     <br>mouseDown: evt<br>    brush := Pen newOnForm: form.<br>    brush roundNib: 3.<br>    brush color: Color red.<br>    lastMouse := evt cursorPoint - bounds origin.<br>    brush drawFrom: lastMouse to: lastMouse.<br>    self invalidRect:<br>    ((lastMouse - brush sourceForm extent corner:<br>    lastMouse + brush sourceForm extent)<br>    translateBy: bounds origin).<br>     <br>     <br>mouseMove: evt<br>    | p |<br>    p := evt cursorPoint - bounds origin.<br>    p = lastMouse ifTrue: [^ self].<br>     brush drawFrom: lastMouse to: p.<br>    self invalidRect: ((<br>        ((lastMouse min: p) - brush sourceForm extent) corner:<br>        ((lastMouse max: p) + brush sourceForm extent))<br>            translateBy: bounds origin).<br>    lastMouse := p.<br>     <br>     <br>addCustomMenuItems: aCustomMenu hand: aHandMorph<br>    super addCustomMenuItems: aCustomMenu hand: aHandMorph.<br>    aCustomMenu add: &#39;clear&#39; action: #clear.<br>     <br>     <br>clear<br>    form fillColor: Color veryLightGray.<br>    self changed.<u></u><u></u></p></div><p class="MsoNormal">&quot;Class PaintMorph&quot;<u></u><u></u></p><div><p class="MsoNormal" style="margin-bottom:12.0pt">Morph subclass: #PaintMorph<br>    instanceVariableNames: &#39;form brush lastMouse&#39;<br>    classVariableNames: &#39;&#39;<br>    poolDictionaries: &#39;&#39;<br>    category: &#39;Morphic-Fun&#39;<u></u><u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">&quot;Workspace&quot;<br>PaintMorph new openInWorld.<u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Thank you in advance.<u></u><u></u></p></div></div></div><div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">2016-08-20 18:47 GMT+02:00 Bert Freudenberg &lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;:<u></u><u></u></p><div><p class="MsoNormal">Sure. Just ask some specific questions - e.g. what you tried, what worked, what didn&#39;t etc.<u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">- Bert -<u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p><div><div><div><p class="MsoNormal">On Sat, Aug 20, 2016 at 10:59 AM, roger mpouma &lt;<a href="mailto:rmpouma@gmail.com" target="_blank">rmpouma@gmail.com</a>&gt; wrote:<u></u><u></u></p></div></div><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt"><div><div><p class="MsoNormal">Hello, <br>I need help for a drawing project on Squeak. I&#39;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 ?<br><br>Thank you in advance. <u></u><u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12.0pt">______________________________<wbr>_________________<br>Beginners mailing list<br><a href="mailto:Beginners@lists.squeakfoundation.org" target="_blank">Beginners@lists.<wbr>squeakfoundation.org</a><br><a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.<wbr>org/mailman/listinfo/beginners</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"> <u></u><u></u></p></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>______________________________<wbr>_________________<br>Beginners mailing list<br><a href="mailto:Beginners@lists.squeakfoundation.org" target="_blank">Beginners@lists.<wbr>squeakfoundation.org</a><br><a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.<wbr>org/mailman/listinfo/beginners</a><u></u><u></u></p></div><p class="MsoNormal"> <u></u><u></u></p></div></div></div></div></div><p class="MsoNormal" style="margin-bottom:12.0pt"><br>______________________________<wbr>_________________<br>Beginners mailing list<br><a href="mailto:Beginners@lists.squeakfoundation.org" target="_blank">Beginners@lists.<wbr>squeakfoundation.org</a><br><a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.<wbr>org/mailman/listinfo/beginners</a><u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div><br>______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.<wbr>squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://lists.squeakfoundation.<wbr>org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>