Squeak

 

Adding tiles to Text Morph viewer

Page history last edited by aikidave 3 yrs ago

Adding new tiles?

 

I'd like to add a few tiles to the TextMorph viewer and I was wondering

where I can write the code to do this. I've looked through

Morphic-Kernel, Morphic-Basic, Morphic-Text Support and Morphic-Scriptors,

etc. to try to find where tile functions are defined and how tiles are

created, but I've been getting a little bit lost in all of the methods.

 

I saw some methods under TextMorph's "scripting access" that match the

text-specific viewer tiles. Can I just add a few methods there and have

them automatically tiled and added to textmorph viewers or is there a

more involved multi-layer process?

 

I also saw that many of the viewer tile scripts are defined in

Morphic-Scripting Player. . . again, is this the place to define new

methods to create new tiles?

 

 

See the method TextMorph class>>additionsToViewerCategories.

That is where you need to add a line for each new tile you want.

Make a duplicate of the inner array below, and edit it.

 

#((basic "The category name in the viewer" (
(slot  characters "name on the tile"
'The characters in my contents'   "balloon help string"
String    "Type that it returns"
readWrite  "both setting and getting"
Player  "put into viewers on objects of this class"
getCharacters   "getter selector  (your method name goes here)"
Player   "put into viewers on objects of this class"
setCharacters:    "setter selector  (your method name goes here)")
"another slot" )))

 

Oh, excellent! Thanks so much!

I was looking in the instance variables and didn't see the method under class variables.

Comments (0)

You don't have permission to comment on this page.