[Cuis-dev] Morphic glitches out/hangs when adding faulty code to drawOn method on morphs that step

Alan Dao alan.n.dao at gmail.com
Wed Dec 14 22:43:36 PST 2022


Hi all,

I've been working on a project in Cuis that involves real-time
visualizations. As part of this project, one of my morphs steps 60 times a
second. Part of my workflow involves fidgeting with the drawOn method to
change my stepping morph's appearance and I've quickly noticed that Morphic
really doesn't like code that'll throw exceptions in drawOn.

For example, if I put this bad code in the drawOn method for my stepping
morph, the image will just hang. I've tried the interrupt key but it's no
good here.
```
"1.0 isn't a string, so this code will mess up"
aCanvas drawString: 1.0 at: -13 @ 58 font: nil color: Color brown.
```

We can even add this bad code to the drawOn method in other sample stepping
morphs, such as Sample09Clock. While it doesn't spectacularly hang, it
seems to break Morphic rendering of the whole world for the rest of the
image runtime.

I know that the code I've put in is inherently flawed, but my development
process involves experimenting a lot and not always knowing what I'm doing.
Is there something I'm missing when it comes to not having mistakes break
Morphic? Any advice would be appreciated.

Best,
Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20221214/e71830b7/attachment.htm>


More information about the Cuis-dev mailing list