<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
II'm pastiing the BoxMorph class comment for reference: <br>
<br>
Hierarchy for morphs that are rectangle like, and that occupy an
area that can be specified as a Rectangle. This means that, besides
being of rectangular shape, sides are aligned with local coordinate
axes. Including rectangles with rounded corners and such. The idea
is that the 'extent' ivar is all that's needed to establish our
dimensions and shape.<br>
Subclasses can add things like 'roundedCornerRadius' or such.<br>
Note: Answers false to #submorphsMightProtrude. If you need a box
like morph that can hold submorphs that can protrude if (i.e.
submorphs may extend beyond box bounds) DONT subclass from here.<br>
<br>
Hope this helps.<br>
<br>
On 12/15/2024 3:15 PM, Mark Volkmann via Cuis-dev wrote:
<blockquote
cite="mid:CAFfRWnVX4+AT2kVgShc-ZMhLEGt4LnqprZpVkTzrfR-9ccGqXw@mail.gmail.com"
type="cite">
<div dir="ltr">Thanks! I didn't consider doing that because I
didn't want the default light green background. And it seems
"super drawOn: aCanvas" isn't necessary when the superclass is
Morph or PlacedMorph.</div>
<br>
<div class="gmail_quote gmail_quote_container">
<div dir="ltr" class="gmail_attr">On Sun, Dec 15, 2024 at
11:51 AM Mariano Montone <<a moz-do-not-send="true"
href="mailto:marianomontone@gmail.com">marianomontone@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div>
<p>You are forgetting to call to super. Always consider that
when you are overriding a method.</p>
<p>It works. Look at screenshot attached.</p>
<div>El 15/12/24 a las 13:41, Mark Volkmann escribió:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">On Sun, Dec 15, 2024 at 7:37 AM Mariano
Montone via Cuis-dev <<a moz-do-not-send="true"
href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>>
wrote:<br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0px 0px
0px 0.8ex; border-left: 1px solid rgb(204, 204,
204); padding-left: 1ex;">
<div>
<p>Hi Mark,<br>
</p>
<div>El 14/12/24 a las 22:42, Mark Volkmann via
Cuis-dev escribió:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>
<div>I'm trying to understand what is
required to create a subclass of<span> </span><font
face="monospace">BoxMorph</font>. I know
I need to implement the<span> </span><font
face="monospace">drawOn:</font><span> </span>instance
method. And I believe that depending on
how I implement that, I need to implement
the<span> </span><font face="monospace">requiresVectorCanvas</font><span> </span>method
to return true.</div>
<div><br>
</div>
<div>Is anything else required? I think more
must be required, because I can't get a
basic example to work doing only those
things.</div>
</div>
</div>
</blockquote>
Have you tried browsing BoxMorph hierarchy and
looking at its subclasses?<br>
</div>
</blockquote>
<div><br>
</div>
<div>Yes. In particular I looked at <font
face="monospace">ColoredBoxMorph</font>. That has
no class methods and 6 instance methods. The only
method that does something not directly related to
color is <font face="monospace">color:</font> which
sends <font face="monospace">#redrawNeeded</font>
to <font face="monospace">self</font> when the
color is changed. The <font face="monospace">initialize</font>
method sends <font face="monospace">#color:</font>
with the default color, so I thought perhaps when
subclassing <font face="monospace">BoxMorph</font>,
I need to send <font face="monospace">#redrawNeeded</font>.
I added the following instance method, but that
didn't help. </div>
<div><br>
</div>
<div><font face="monospace">initialize<br>
super initialize.<br>
self redrawNeeded</font><br>
</div>
<blockquote class="gmail_quote" style="margin: 0px 0px
0px 0.8ex; border-left: 1px solid rgb(204, 204,
204); padding-left: 1ex;">
<div>
<blockquote type="cite">
<div dir="ltr">
<div>
<div><br>
</div>
<div>I'd especially appreciate it if someone
can tell me how I could have determined
the answer on my own by looking at the
source. I tried to do that and failed.</div>
</div>
</div>
</blockquote>
<p>How is it failing? Perhaps attach example of
what you are trying to do ... it shouldn't be
much more than implementing a #drawOn: method
...</p>
</div>
</blockquote>
<div><br>
</div>
<div>If I create the class <font face="monospace">Try1</font>
as a subclass of <font face="monospace">Morph</font>,
add the following <font face="monospace">drawOn:</font>
method, and evaluate <font face="monospace">Try1</font>
new openInWorld in a workspace, it works as
expected.</div>
</div>
<div><br clear="all">
</div>
<div><font face="monospace">drawOn: aCanvas<br>
aCanvas class name print.<br>
aCanvas strokeWidth: 10 color: Color red do: [<br>
aCanvas<br>
moveTo: 100 @ 100;<br>
lineTo: 200 @ 200<br>
].</font><br>
</div>
<div><br>
</div>
<div>If I create the class <font face="monospace">Try2</font>
ais a subclass or <font face="monospace">PlacedMorph</font>,
add the same <font face="monospace">drawOn:</font>
method, and evaluate <font face="monospace">Try2 new
openInWorld</font> in a workspace, it also works.</div>
<div><br>
</div>
<div>But if I create the class <font face="monospace">Try3</font> as
a subclass of <font face="monospace">BoxMorph</font>,
add the same <font face="monospace">drawOn:</font>
method, and evaluate <font face="monospace">Try3 new
openInWorld</font> in a workspace, it does not work.
I get the error <span style="font-family: monospace;">"MessageNotUnderstood:
HybridCanvas>>strokeWidth:color:do:"</span><font
face="arial, sans-serif">. I understand that is
because </font><font face="monospace">BoxMorph</font><font
face="arial, sans-serif"> u</font>ses <font
face="monospace">HybridCanvas</font> by default
instead of <font face="monospace">VectorCanvas</font>,
so I added the instance method <font face="monospace">requiresVectorCanvas</font>
which returns <font face="monospace">true</font>.
That eliminates the eror, but doesn't result in
rendering anything. So it's not clear to me what I'm
missing in my <font face="monospace">Try3</font>
class.</div>
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div><font face="arial, helvetica,
sans-serif">R. Mark Volkmann</font></div>
<div><span style="font-size: 12.8px;"><font
face="arial, helvetica, sans-serif">Object
Computing, Inc.</font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<div><br clear="all">
</div>
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div><font face="arial, helvetica, sans-serif">R.
Mark Volkmann</font></div>
<div><span style="font-size: 12.8px;"><font
face="arial, helvetica, sans-serif">Object
Computing, Inc.</font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich</pre>
</body>
</html>