Make moving (reordering) blocks inside a script less frustrating

Yes - we can run our own versions of Snap! (without cloud login facility) by just downloading the source code and just opening the index.html file with a browser :slight_smile:

(I believe you can get cloud as well but that requires having your webserver AFAIK)

I found the right-click menu code section and just copy/pasted the code for the duplicate entry and then just called the code that deletes a block after making the copy

1 Like

So, you have your own personal copy of Snap! source code? Wow.

I would be too afraid to mess things up, if I tried to edit anything in source code. It seems you are not afraid of messing up things.

That is useful for prototyping just the way you did it now. Do you have any special editor for source code editing?

Can you make a short tutorial and show exactly how you did this prototype?

1 Like

The syntax came from the discussion in the GP forum

and as @tguneysu posted, John (Maloney) has implemented the idea in Microblocks so at the moment, its the de-facto standard :slight_smile:

I'm not tied to the name but the all the action does is "extract" the block from the script - it doesn't move it anywhere in particular (Just like the duplicate blocks - they just make a copy - they don't move/put them anywhere)

"Move" meant to be what you wanted to achieve, and therefore, what you will probably look for in the context menu. But true, it's not strictly what it does. However, you will automatically hold that block after clicking on that menu item, so you will move it together with the mouse pointer. (At least "duplicate" does that.) So it's not a lie either if we call it "move".

One caveat... what's with the touch interface. There you won't hold the block initially. (I never even tried Snap with touch, but I assume so.) Well, you still moved the block out of its original place...

I just used Notepad++ (I'm using Windows)
Every now and then I try playing with specialist code editors but I find them too complex for my simple needs :slight_smile:

Unfortunately, I'm not very good at writing tutorials/documentation :frowning:

Here's what I do:

[scratchblocks]
... a :: grey
block or script to move
... b :: extension
[/scratchblocks]

Drag ... b above block or script to move

[scratchblocks]
... a :: grey
... b :: extension
block or script to move
[/scratchblocks]

Then move block or script to move to where I want it

1 Like

It's like playing "Tower of Hanoi" :wink:

1 Like

Since cymplecy was so quick with the extract idea ( THANKS CYMPLECY), another GREAT feature I like in block IDE's is the "DISABLE BLOCK" feature in MIT App Inventor.
One R-click selects it in the menu and the block turns light grey / beige color and will not be executed in the stream that it is located. Another R-click and "ENABLE BLOCK" activates the block again.
Great debugging tool without messing up the order / sequence of blocks, which is my biggest gripe with long block sequences that are riddled with C-Blocks to boot.

3 Likes

This is a makeshift solution. The project adds "grab this" menu item as described by @cymplecy.
Sprite can be exported and dragged to any other project.
https://snap.berkeley.edu/snap/snap.html#present:Username=dardoro&ProjectName=userMenu.grabThis&editMode&noRun

2 Likes

Do you know about the keyboard editor? Reference Manual page 115.

ooh - very clever - I didn't know we could add a menu item from Snap! :slight_smile:

JFI - I just use the old Scratch method of a simple repeat loop 0/1 (or false/true) when I need to comment out some code

(I also sometimes use it break-up a script to let me easily switch different versions of a set of blocks in and out easily)

image

1 Like

Interesting. Why REPEAT and not IF? That seems more expressive of the intent to me.

Yes, I know about keyboard input, but one of the points of a visual editors like this is that kids don't have to type. (Besides, the keyboard input support could be improved too, but this is OT.)

Its quicker to just drag a repeat block out than use an if and have to add a predicate

Plus a repeat 0/1 block stands out as being a pure debugging construct

2 Likes

I have updated the Feature Request description. Instead of hovering and check boxes now it says:

But it could become much better, if Snap supported selecting multiple blocks. The context menu could have "Start selection", which after clicking allows you to select the other end of the consecutive blocks, then clicking that makes them all selected. Then, with "Move" all that could be moved at once. Selection also could work with other operations, like Delete, Duplicate, etc.

1 Like

+ 1,000,000,000,000 (In words: oh, where have you been when I needed your really quick way of commenting code out ;~) )

Thank you for sharing it now (or, as an old saying goes, 'better late than never').

1 Like

Thanks! I've implemented this feature for the upcoming v6.3 minor release. Instead of ctrl you'll be holding down the shift key to extract a single command block from within a stack. In addition there will be an "extract" option in the context menu.

That's awesome! How can we check inside Snap! What version is in effect?

If you look at the tab shape above the Snap! browser window it should say "Snap! 6.2.4 Build Your Own Blocks."

Alternatively, click on the Snap! logo at the top left corner of the window and choose "About" to see the version along with a lot of other info.