--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/blockly/dbd7b21a-f33b-45cf-b93d-84471efe7d59n%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/blockly/CAOk7GcSCBPj2EwU6BQ67-4chFpPxE65DF4BGHBp%3DGBPD2enwYw%40mail.gmail.com.
I think I have found that the call to get the menu doesn't occur until its parent is expanded (which means I can dynamically populate the json) and then for the blocks for each component I can use a combination of the dynamic category (which you mentioned) along with seeing which item in the toolbox has been selected last in order to populate it. Does that seem like a reasonable way to do this?
For future consideration, what I would love is something like this:{
"kind": "category",
"name": "My category",
"custom": "MY_CUSTOM_CATEGORY",
"extraState": { arg0 : "blah" },
},
where the extraState was passed into the flyoutCallback so you could make one instance of the callback that would populate itself differently based off of what was pased in.
// Returns an array of objects.
var fyoutCallback = function(workspace, info) {
// ...Returns an array of hex colours, e.g. ['#4286f4', '#ef0447']
return blockList;
};
// Associates the function with various strings.myWorkspace.registerToolboxCategoryCallback('CATEGORY_1', (workspace) => flyoutCallback(workspace, {arg0: 'blah'})); myWorkspace.registerToolboxCategoryCallback( 'CATEGORY_2', (workspace) => flyoutCallback(workspace, {arg0: 'blerg'}));
--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/blockly/CAN0w5ea7enzowtbg5Uz5YgOVAufT7kh0sGMwXJXhwjnUsF%2BdGg%40mail.gmail.com.
I was trying to copy the extraState idea from how the typical blocks do it, because that allows you to put more of things that need to be different in JSON instead of scattering them between JSON and typescript. If you prefer, a third alternative that could work well would be to pass the toolboxitemid to the callback function. This would get away from language issues of passing the name.
--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/blockly/CAN0w5eb74V8ixK-cKFgztaJm-bzmHi%3DgtUNfibD2A%2BsBcOi7%3Dw%40mail.gmail.com.
I put this in as a feature request: https://github.com/google/blockly/issues/9168
Please let me know of things here that aren't clear.
{
"kind": "category",
"name": "My category",
"custom": "MY_CUSTOM_CATEGORY",
"extraState": { arg0 : "blah" },
},
Not being familiar with contributing to Blockly, should I wait for team discussion on it before starting to work on a PR?
I think that this should be fairly straightforward, but often things that are thorny look that way before starting on them. Or as the saying goes, "We do these things not because they are easy, but because we thought they were going to be easy when we started them."
--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/blockly/CAN0w5ebaY-SoU8H3Qe8iMW3jnqMT8n-SNmyRRH%3DwmZGoZ5UyEA%40mail.gmail.com.