I’m playing around with making some custom blocks, and I’m running into an issue with expandable arguments coupled with an enum picker.
Everything seems to work fine with either feature (my function with expandable arguments but no enum parameter OR my function with an enum picker but no expandable arguments). But when I use them in combination the block breaks (gets stuck to the cursor; can’t be trashed) when I interact with the + expander.
Here’s my custom.ts
—if it’d be better to publish a project I could do that too.
enum Anchor {
//% block="top left"
TopLeft,
//% block="bottom right"
BottomRight,
}
namespace inputs {
//% block="show a simple menu with %options||anchor %anchor foreground %foreground background %background"
//% expandableArgumentMode=toggle
//% anchor.defl=TopLeft
//% foreground.shadow=colorindexpicker
//% foreground.defl=1
//% background.shadow=colorindexpicker
//% background.defl=15
export function showSimpleOptionMenu(options: string[], anchor: Anchor, foreground: number, background: number) {
return 0; // index of selected option
}
}
Am I doing something wrong? Thanks!