I am trying to have a class I am creating be previewed as a list. When you click on a variable with an instance of this class as its value, it will preview it as a list. But when you use it in code, it will still work as intended. I'm pretty sure this is possible because I got it to work using the toString() method.
I tried having the toString() method return a List object. Obviously this wouldn't work though because the code assumed it was a string, and it caused a lot of errors. I have also tried calling the List.toString method but that doesn't cause the preview to be a list, but a string.
The first of those pictures isn't getting you "the preview for a list"; it's getting a list! Lists know how to display themselves, in various formats. But there's no reason to expect other objects to know how to display themselves as pseudo-lists.
If I wanted to do what I think you want to do, I'd write a block that constructs a list of the fields of an instance of your class--an actual list, not a picture of one--and then let Snap! take care of displaying it.
I do still have one question to clarify: I'm having the block that creates the object just return a list of the fields, but what if I want to keep some of the properties hidden? Like in by second screen shot, it displays the result as "test", but I can still get the other hidden properties when the value is inputted into another function.