Console for Snap! projects

I'm trying to create a console for Snap! projects. It will have both input and output support, and it will display in a DialogBoxMorph.

https://snap.berkeley.edu/snap/snap.html#present:Username=bluebaritone21&ProjectName=Console

Here is a mockup I made in devmode:

a DialogBoxMorph 5 [184@68 | 761@359]

My question is, what do you want this to do? I know it's a console, but there should be some purpose to fulfill.

I specifically am trying to make it for my BariLang Interpreter. See also "Parsing Lisp code in Snap!".

I guess, what I should say is that I want to make a CLI for Snap!.

To have a program that interacts with the user and keeps a visible record of the interaction history, as opposed to ASK and ANSWER, which just shows one line. And to edit data from the net, e.g., remove the dirty words from a dictionary. (The interaction history and the editor are two sort of different kinds of text window.) In the Listener window (the official name of the first kind) what the user types is shown in boldface; what the computer types is in lightface. And the user can't insert or delete text except on the very last line of the window, before hitting Enter.

That's a slight simplification; details are in the Window chapter of the Object Logo manual.

pic
This is okay, but I'd prefer if I didn't have to say the box.

I've got it rendering without say!
pic
pic

Now, I need to figure out how to add a scrollMorph.

How do I attach a morph to another morph?

Okay. I've narrowed down what I need to do. I need to create a ScrollFrameMorph rendered in the DialogBoxMorph. Then, I need to add a text box to the bottom of the dialog, with a button next to it. I need to add a TextMorph in the Scroll Frame, and then a button next to the text box. Here is a mockup I made in devmode:

Dialog Box ->
ScrollFrame ->
Text        -->

TextBox ->
Button ->

a DialogBoxMorph 6 [235@94 | 473@358]
What do you think, Brian?

Okay, I'm trying to create a more general set of blocks for creating Morphs to help with this, but I'm not sure what's wrong with this:
pic

Why do you need the one-line text field at the bottom? The user should type directly into the big black text box. (And of course that typing should be editable. I guess that's the point of the extra text field, but you should be able to simulate the text editing capability right in the text box.)

In a perfect world, the first user character not yet read by the program should be underlined; everything from there to the end of the text is editable.

I can see why you want the one-line text field at the bottom: It already has text editing capability, so you don't have to invent all that ^A for beginning of line stuff. I suppose one way to do it would be to have an offscreen text field and keep duplicating its contents into the actual text box.

Thanks for your feedback. I'm pretty new to Morphic (I just started using it today lol), so I don't know some (probably obvious) features.

If you've spent a whole day on Morphic you probably know more about it than I do!

well, your error is in morph.addBody(thing), if that helps/

edit: is the dialogbox orphaned? i think that might be an issue

pic
Okay, This works. (If you are interested, I changed up the dialog box code. I put it in a run so that it wouldn't spawn another one when it shows the return value.)

I wish. With school and my dayjob, I've probably only spent ~30 minutes reading Morphic or widgets. The rest is just trying a whole bunch of stuff.


I just shared my project. Here's the link.

you should expand the scroll frame:

scroll = new ScrollFrameMorph()
scroll.setWidth(600)
scroll.setHeight(450)
return scroll

or, as a block:
Console script pic

Ok. I have the (basic) formatting of the console done, but I can't seem to get the scroll frame to ... scroll.

There are some old experiments with the morphic dialogs
helicoptur&ProjectName=custom dialog
dardoro&ProjectName=console

Why can't you just display the console on the stage?
It's not hard; here's a very very unfinished project of mine that does it: Snap! Build Your Own Blocks

I've done that before, but I want to keep the stage clear so that other information can be displayed. (Think The Lab)

I'd like to be able to have multiple text boxes, move them around, etc. My plan is that a text box should be a kind of costume so that you can move it around by moving the underlying sprite. And you can ask it to do things from another sprite's script, etc.