[Cuis-dev] SVGs and using reflection to call class methods
Mark Volkmann
r.mark.volkmann at gmail.com
Wed Jun 19 17:44:12 PDT 2024
Here are my notes on working with SVGs in Cuis:
- Open a terminal.
- Clone the following Git repositories from Cuis Smalltalk:
- https://github.com/Cuis-Smalltalk/Numerics.git
- https://github.com/Cuis-Smalltalk/SVG.git
- Open a Workspace window and install the packages `LinearAlgebra` and `SVG.
For each package, enter `Feature require: '{package-name}'` and "Do it".
- Enter `SVGMainMorph exampleTiger openInWorld` and "Do it".
Now that I have this working, I wanted to see if I could use reflection
to open all the examples.
I know I can just do this: SVGMainMorph openAllExamples SVGMainMorph.
But I wanted to see if I could do it with reflection. Here is what I tried.
metaclass := SVGMainMorph class.
selectors := metaclass allMethodsInCategory: #examples.
selectors do: [ :selector |
(selector beginsWith: 'example') ifTrue: [
(MessageSend receiver: metaclass selector: selector) openInWorld
]
].
This gives me "MessageNotUnderstood" on the send of openInWorld because
apparently the code "MessageSend receiver: metaclass selector: selector"
does not return a Morph. It's not clear to me why it doesn't.
--
R. Mark Volkmann
Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240619/fdc59830/attachment.htm>
More information about the Cuis-dev
mailing list