Custom blocks (Part 1)

@helicoptur @cst1229
image
image

I like it !

Can you add some features ? like background color, color of the input field, (x,y) position.

Good work

I'll be gone on vacation for 1 week, don't worry if you don't get an answer by ...

Can you add a block that calculates the mean, median, mode or range of a list?

bump!

Why are you bumping this?

maybe he's waiting to be answered?

Here's a menu block. (It includes support for submenus)

Could you please provide a project link?

I don't have a project that has it (at the moment).
But if you want the code for quick copy-pasting, then here you are:

let result = false;

function menuFromItems( lstItems){
let menu = new MenuMorph( item=>result=item);
lstItems.asArray().forEach( it=>{ 
let itName = itVal = it;
if( it instanceof List){
      [ itName, itVal] = [it.at(1), it.cdr()];
      itVal = menuFromItems( itVal);
      menu.addPair( itName, itVal, '\u25ba');
    }
    else if( it == "~")
menu.addLine();
else if( it == "")
menu.addItem( "close", true);
else menu.addItem( itName, itVal);
 });
 return menu;
} 
let m = menuFromItems( items); 
m.title = ti;
m._destroy = m.destroy;
m.destroy= ()=>{ result ||= true; m._destroy()};
m.popUpAtHand( this.world());

return ()=>result;

Here's the code for the blockJS-13.0 script pic (3) block:

Can you show me the code?

Simpler:
untitled script pic (100)


You forgot to add inputs for the menu block.

OK.

How to make submenus?

<p> tags ugh.

That isnt related to the topic.

Put a list into one of the item inputs. Like this:

What’s wrong with <p> tags?