Discuss Scratch
- Discussion Forums
- » Developing Scratch Extensions
- » Buttons in the block palette?
- Znapi
- Scratcher
500+ posts
Buttons in the block palette?
Is is possible to add buttons to the block palette from an extension, like the ‘create a variable’ button? I want make a button that opens a special gui in the Scratch editor for ease of access. I looked at the Scratch source, and it uses code like this:
to add buttons when building the block palette for the data category. I am guessing that for this to work in extensions, it would be something in the descriptor along with the block specifications that would cause it to put a button when building the extension block palette.
I guess I could use a workaround like in this extension by djdolphin uses blocks with a type set to null to make them square, and they can be used as buttons. Is adding an actual button like the ‘add an extension’ one known to be impossible?
addItem(new Button(Translator.map('Make a Variable'), makeVariable));
I guess I could use a workaround like in this extension by djdolphin uses blocks with a type set to null to make them square, and they can be used as buttons. Is adding an actual button like the ‘add an extension’ one known to be impossible?
Last edited by Znapi (May 24, 2015 20:40:41)
- MegaApuTurkUltra
- Scratcher
1000+ posts
Buttons in the block palette?
Nope, that's not going to be possible from within an extension. You'll need to make a mod.
$(".box-head")[0].textContent = "committing AT crimes since $whenever"
- TheMonsterOfTheDeep
- Scratcher
1000+ posts
Buttons in the block palette?
Or, you can try what I'm half working on with my extension - making a button using HTML and overlaying it on top of the editor. You can then have buttons for all sorts of things.
Of course, because of all the stuff that goes on in the editor, I thought the best part to put such a button is on the top bar, which never seems to change, but then a lot of buttons would fill it up quite quickly - so I suggest making a dropdown menu type button if you are going to have more than one button.
Of course, because of all the stuff that goes on in the editor, I thought the best part to put such a button is on the top bar, which never seems to change, but then a lot of buttons would fill it up quite quickly - so I suggest making a dropdown menu type button if you are going to have more than one button.
my latest extension: 2d vector math
- Jonathan50
- Scratcher
1000+ posts
Buttons in the block palette?
Cool Idea, but just doing that might have issues with multiple extensions unless they are designed to go in different spaces or can somehow detect the other extension Or, you can try what I'm half working on with my extension - making a button using HTML and overlaying it on top of the editor. You can then have buttons for all sorts of things.
Of course, because of all the stuff that goes on in the editor, I thought the best part to put such a button is on the top bar, which never seems to change, but then a lot of buttons would fill it up quite quickly - so I suggest making a dropdown menu type button if you are going to have more than one button.
Not yet a Knight of the Mu Calculus.
- Jonathan50
- Scratcher
1000+ posts
Buttons in the block palette?
That's really cool, I never knew that Is is possible to add buttons to the block palette from an extension, like the ‘create a variable’ button? I want make a button that opens a special gui in the Scratch editor for ease of access. I looked at the Scratch source, and it uses code like this:to add buttons when building the block palette for the data category. I am guessing that for this to work in extensions, it would be something in the descriptor along with the block specifications that would cause it to put a button when building the extension block palette.addItem(new Button(Translator.map('Make a Variable'), makeVariable));
I guess I could use a workaround like in this extension by djdolphin uses blocks with a type set to null to make them square, and they can be used as buttons. Is adding an actual button like the ‘add an extension’ one known to be impossible?
Not yet a Knight of the Mu Calculus.
- TheMonsterOfTheDeep
- Scratcher
1000+ posts
Buttons in the block palette?
Or you can just reset the plugin when you load your extension if you're really mean.Cool Idea, but just doing that might have issues with multiple extensions unless they are designed to go in different spaces or can somehow detect the other extension Or, you can try what I'm half working on with my extension - making a button using HTML and overlaying it on top of the editor. You can then have buttons for all sorts of things.
Of course, because of all the stuff that goes on in the editor, I thought the best part to put such a button is on the top bar, which never seems to change, but then a lot of buttons would fill it up quite quickly - so I suggest making a dropdown menu type button if you are going to have more than one button.
Yeah, maybe someone should make a little thing for extensions that makes a menu by default that each extension can add their own buttons to so that any extensions using that library or whatever will be compatible.
my latest extension: 2d vector math
- MAMCpro
- Scratcher
1 post
Buttons in the block palette?
Well, it should probably be possible to make the buttons using just HTML.
However, the Button tag is unreliable because it differs by platform, unlike the built in ones.
However, the Button tag is unreliable because it differs by platform, unlike the built in ones.
- Discussion Forums
- » Developing Scratch Extensions
- » Buttons in the block palette?