How do you create different displays for objects and datatypes?

The way I see it, different datatypes are displayed with a bubble, and the way they are displayed within that bubble are with different morphs.

How do I make an object class that can be displayed with a morph?
I’ve tried using morphs straight up, with my XML Library project, but it takes up way too much data.

Examples

text: TextMorph untitled script pic (17)
lists: ListWatcherMorph


tables: TableFrameMorph
sprites: SpriteMorph
costumes: Morph

I’m guessing you’re asking for a Snap! mod? If not, you’ll have to monkeypatch it, which I’m not getting into to. But if you ARE talking about a Snap! mod (and can edit the source code), then what you need to look for is something like “instanceof Color” (global search) and look for instances of that that look like their generating a morph from a data type (usually a if block) and add another condition, for your datatype.

Back to the monkeypatching thing. No one wants to enable JS for a library, for displays end users probably wont even see. The best decision for now, is to just made your data type a list. Maybe, eventually, there will be a magical “make [list] a object with render function [code that returns a costume]”, but for now just use lists.

Maybe, eventually, there will be a magical “make [list] a object with render function [code that returns a costume]”

We’re discussing something like that. Since we now have the dictionary-as-object feature, with methods and inheritance and all that, the idea would be that you’d put a render method in your object (being as I am an old Lispian, my preferred name is “printform,” but since in our gui things aren’t exactly printed, maybe your name is better) and we’d call it to create the displayed object. The canonical example would be to display exact rationals as ²²/7.

Unfortunately, I’m not talking about a mod :frowning:

Prompted by this post, I’ve updated my project. You’re probably better off using it for simple things, and @blockpointstudios’s baritone dialect for more complex uses.

i’m not trying to discourage you, this is a very good project made with lots of effort, but i cant seem to use the (extract data in []::operators) block. If i cant extract data from the datatype, the whole thing is basically useless.

i’ve found @blockpointstudios’s better to use, in conclusion. although it isn’t exactly what i’m looking for, it’s close enough.

Please tell me if there are bugs like these! That one was a really stupid mistake that took 2 seconds to solve. It should be working now. I should’ve tested that part before posting (I tested my other changes, but not the one that affected “extract data”).

creating another topic may be better for this, but,
m4sisb Types different script pic
(this is the hidden bignum example).
anyway, I remember when this was first made! this was really fun to play around with, and still is.

I’d recognize those chunky borders from a mile away! Anyway, that was an artifact of saving 104/10 as a hidden bignum whilst the previous bug still existed, thus there was some wrong data. I just used the “clear data” and saved the project, and it now works. Thanks for letting me know.

Thanks! One of the updates I made was changing the buttons to reporters (from commands) because they look more like buttons, and I can prevent them from reporting or erroring by using report (reshape (list@>) to @:>.

Hopefully there aren’t any more bugs, but if there are, this may be necessary.