[Cuis-dev] possible morph bug

Nicolás Papagna Maldonado nicolas.papagna at gmail.com
Sat Jun 8 09:19:45 PDT 2024


Thanks, Mariano!

You're right!
I keep having this feeling that #redrawNeeded does it right away.
My bad.

Cheers!
Nico PM

On Sat, Jun 8, 2024, 13:05 Mariano Montone <marianomontone at gmail.com> wrote:

> Hi Nico,
>
> I think there's no performance penalty. #redrawNeeded just sets a flag to
> mark the Morph for a redraw for the next iteration of Morphic "drawing
> loop".
>
> The change does not happen immediately.
>
> So, you can mark as many Morphs as you want for redrawing and for layout,
> and they are updated in next Morphic loop iteration.
>
> If that's the case, then I think it would be good to add #redrawNeeded to
> the #label: protocol.
>
> I can can be wrong, though..
>
>     Mariano
> El 8/6/24 a las 12:58, Nicolás Papagna Maldonado escribió:
>
> Hi folks!
>
> Not an expert, but my hunch is that those methods don't call #redrawNeeded
> because it's up to the caller to decide that.
>
> Escenario: I am changing many things about a morph/button (say label,
> color, etc) and I want it to be redrawn only when Im done to keep things
> optimized.
>
> Maybe that's the case (I'm sure that Juan knows about this).
>
> Cheers,
> Nico PM
>
>
>
> On Fri, Jun 7, 2024, 21:12 Mariano Montone via Cuis-dev <
> cuis-dev at lists.cuis.st> wrote:
>
>>
>> El 7/6/24 a las 16:14, Mark Volkmann via Cuis-dev escribió:
>> > I opened an Inspect window for a PlugglableButtonMorph that is visible
>> > in the world.
>> > I entered this in the bottom pane and pressed cmd-d to "Do it":
>> > self label: 'My New Label'.
>> > The label on the button did not update.
>> Yes. I think a #redrawNeeded should be sent in #label: or #label:font:
>> implementations.
>> > Then I entered this and pressed cmd-d:
>> > self color: Color pink.
>> > The background color changed AND the label updated.
>> > Is there a reason why the label update didn't occur until I
>> > changed the color?
>>
>> The reason is that the #label: message does not call #redrawNeeded
>> (although I think it should).
>>
>> You can solve it by sending it yourself: myButton label: 'My label';
>> redrawNeeded.
>>
>> Same problem if the change of a button label affects the layout (it
>> does). You need to call #someSubmorphPositionOrExtentChanged on the
>> button's owner manually yourself.
>>
>> Not ideal.
>>
>>
>>      Mariano
>>
>> --
>> Cuis-dev mailing list
>> Cuis-dev at lists.cuis.st
>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240608/ae96ac00/attachment-0001.htm>


More information about the Cuis-dev mailing list