<div dir="ltr">Gerald, thanks so much for explaining that!</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 22, 2024 at 5:55 AM Gerald Klix via Cuis-dev <<a href="mailto:cuis-dev@lists.cuis.st">cuis-dev@lists.cuis.st</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi Mark,<br>
<br>
please apologize that I do not send mail to your GMail account.<br>
They won't accept my mail, because it's not DKIM-signend,<br>
but they send me DKIM-signed spam about once week.<br>
Result: I blocked a wide range of IP addresses belonging to them<br>
at my firewall; even DNS is blocked, so no mail from or to GMail.<br>
<br>
<br>
Back to your question(s), especially to those you did not ask :]<br>
<br>
1) Adding morphs in #initialize and then removing them in a subclass' <br>
#initialize<br>
method creates some objects that will immediately become garbage,<br>
it's a waste of resources. Therefore a better solution is to factor<br>
out that creation of the adjuster morphs into a separate method<br>
and redefine that method in that subclass to do nothing.<br>
<br>
2) The "best" solution is to start with that fixed size window<br>
as a superclass and make SystemWindow a subclass containing<br>
the resizing logic including the adjusters instance variable.<br>
If there are many applications for fixed size windows,<br>
this huge change will be well worth it.<br>
<br>
3) Your original questions has two answers:<br>
<br>
a) For reasons unknown to me – if I had to guess,<br>
I would say memory consumption – when Morphic for Squeak<br>
was invented a PC/Mac with 32 *Mega*bytes of main memory<br>
was a huge machine – the submorphs instance variable always<br>
holds an array and not, as one might expect, an OrderedCollection.<br>
Therefore removing or adding a sub-morph is an operation<br>
more costly than you might suspect. If you look at<br>
Morph>>#removeAllMorphsIn: you will see that<br>
Juan went to great length to make that operation still<br>
efficient.<br>
<br>
b) Iterating over collections while changing them is<br>
prone for disaster in most programming languages.<br>
<br>
For Cuis' sub-morphs you can use `self submorphs do:`<br>
instead of `submorphsDo:`, because #submorphs<br>
answers a copy of that aforementioned array of sub-morphs.<br>
In this particular case you can even get away by using<br>
#submorphsDo: and removing the adjuster morphs one by one,<br>
because removing a morph boils down to sending #privateRemove:<br>
to the SystemWindow instance. #privateRemove: is defined like this.<br>
<br>
privateRemove: aMorph<br>
     "Private! Should only be used by methods that maintain the <br>
ower/submorph invariant."<br>
     submorphs := submorphs copyWithout: aMorph.<br>
<br>
You see that #privateRemove copies the submorphs array,<br>
therefor you are safe.<br>
So if you do it that way, you create eight copies of that sub-morph array,<br>
of which 7 immediately become garbage.<br>
<br>
<br>
HTH and Best Regards,<br>
<br>
Gerald<br>
<br>
<br>
On 8/22/24 3:21 AM, Mark Volkmann via Cuis-dev wrote:<br>
> Thanks so much Gerald! Is there a reason why you collect the morphs to<br>
> remove in an OrderedCollection and then iterate over that to delete them<br>
> versus just removing them in the block passed to submorphsDo?<br>
><br>
> On Wed, Aug 21, 2024 at 11:12 AM Gerald Klix via Cuis-dev <<br>
> <a href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>> wrote:<br>
><br>
>> Hi Mark, Hi Juan,<br>
>><br>
>> It can be done by removing the adjuster morphs.<br>
>> Please see the attached file-out of FixedSizeSystemWindow.<br>
>><br>
>> You can use this code snippet to test it:<br>
>> FixedSizeSystemWindow editText: (TextModel withText: 'Test')  label:<br>
>> 'Test' wrap: false<br>
>><br>
>> On 8/21/24 4:10 PM, Juan Vuletich via Cuis-dev wrote:<br>
>>> On 8/21/2024 10:55 AM, Mark Volkmann via Cuis-dev wrote:<br>
>>>> Is there an easy way to configure a subclass of SystemWindow from<br>
>>>> being resized by the user by dragging a corner or edge?<br>
><br>
><br>
<br>
-- <br>
Cuis-dev mailing list<br>
<a href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
<a href="https://lists.cuis.st/mailman/listinfo/cuis-dev" rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
</blockquote></div><br clear="all"><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>