Escaping equals sign in input slot options

By options menu, I'm referring to the menu which allows you to choose options for a block's input slot.

I tried setting the options to

>
<
>=
<=
=
!=

but when I choose my options from the dropdown list, these options appear:

>
<
close
!

And when I select any of them, the input slot appears blank. Which is weird.

Anyway, I thought of putting a backslash before the equals sign but it didn't work. And it doesn't say anywhere in the options menu dialog, nor anywhere in page 46-47 in the Snap! manual, on how to say that this is supposed to be a regular character and not a key/value pair. So I suppose that means this feature doesn't exist.

There is an (experimental?) feature where you can write a JavaScript function in the menu that returns an object that is used for a menu input. I used it to successfully include equal signs in the menu, but I agree that we should be able to escape them much more easily because:

  1. I don't think a lot of the users know about that feature, and
  2. It is more complex to write the JavaScript function
4 Likes

I would be inclined to work around this by using
BOX DRAWINGS DOUBLE HORIZONTAL U+2550 UTF-8 E2 95 90
or
SMALL EQUALS SIGN U+FE66 UTF-8 EF B9 A6
or something like that.

But maybe we should make backslashing work. I'll look into it.

2 Likes

a simple way to do this is to use chinese keyboard because for some reasons, chinese symbols are different even though they look exactly the same

1 Like

I don't seem able to get this to work - is there something special to be done to enable it?

No, you just write JS code in the box instead of writing option labels.

Well I tried following the format of @snapenilk example and it doesn't work for me

= use this, this is Chinese equal sign, this will work

Thanks but I'm not after the equals sign - I 'm after using javascript to make a custom menu :slight_smile:

ok,but js is very complicated and they have the same function

1 Like

We are all here to learn how to do complicated stuff :slight_smile:

Ok

you have to put a space before the ["a"]: and you also need to put a comma after the "a", at the end of the line, but when I tried doing it, it just doesn't let me click apply or ok to save the custom block. Idk why.

1 Like