menu insert
menu insert
is it possible to insert an entry into a menu? like, not just attach it to the end, but insert it somewhere in the middle (for example, next to the currently highlighted cursor position)
Re: menu insert
also, it would be really nice to have the option to have menus permanently popped out.
Re: menu insert
It is possible to change them... I'm working an example for you to checkout..
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
Re: menu insert
provided you've made a menu object named 'myMenu'
setattribute(myMenu,'items',{'new item1','new item2','new item3'});
to get the current list of menu items:
decl menuList=getattribute(myMenu, 'items');
and use the function subarray(menuList,START,COUNT) to copy items onto/off of the menu into a new array.
I don't have a great example of inserting an item yet.. because this code:
setattribute(myMenu,'items',{subarray(menuList,0,1),'new item 2','new item 3',subarray(menuList,1,sizeof(menuList)-1)});
produces unexpected results in my test.
setattribute(myMenu,'items',{'new item1','new item2','new item3'});
to get the current list of menu items:
decl menuList=getattribute(myMenu, 'items');
and use the function subarray(menuList,START,COUNT) to copy items onto/off of the menu into a new array.
I don't have a great example of inserting an item yet.. because this code:
setattribute(myMenu,'items',{subarray(menuList,0,1),'new item 2','new item 3',subarray(menuList,1,sizeof(menuList)-1)});
produces unexpected results in my test.
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
Re: menu insert
Same here, and I tried a few variations. It doesn't seem to be a problem with the Menu or the setattribute, but you you create the vector. It seems that mixing strings and subarray() to put together a new vector really doesn't work well. Also had problems mixing strings with direct references to individual vector elements.analog604 wrote: I don't have a great example of inserting an item yet.. because this code:
setattribute(myMenu,'items',{subarray(menuList,0,1),'new item 2','new item 3',subarray(menuList,1,sizeof(menuList)-1)});
produces unexpected results in my test.
Re: menu insert
Yes the problem is with the vector/array. It's as if we're using a reference to the array object and not a copy. When I tried to make a copy with additional variable assignment (local to script and object),
I get the same thing.
Attached is a test template for the dynamic menu updating, it's not fully functional because of this 'feature/bug' but you can at least use to see the problem and also replace menu items unless referencing index 0 of the menu.
Maybe I'm just coding it wrong... ? if so then.. !
-J
I get the same thing.
Attached is a test template for the dynamic menu updating, it's not fully functional because of this 'feature/bug' but you can at least use to see the problem and also replace menu items unless referencing index 0 of the menu.
Maybe I'm just coding it wrong... ? if so then.. !
-J
brianc wrote: Same here, and I tried a few variations. It doesn't seem to be a problem with the Menu or the setattribute, but you you create the vector. It seems that mixing strings and subarray() to put together a new vector really doesn't work well. Also had problems mixing strings with direct references to individual vector elements.
- Attachments
-
- example-inserting-removingMenuItems.jzml.zip
- (3.15 KiB) Downloaded 114 times
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
Re: menu insert
if you need a dynamically editable menu, wouldn't it be easier to build one with a container and buttons/text?
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
Re: menu insert
Yes indeed it would be in my experience, Phil!! I try to avoid using menu objects if at all possible due to their limitations and visibility of parameters ... requiring two more taps than would be needed if a button set is used.
But we found a problem with splicing multiple text containing vectors together that I don't remember running into before.
I've had success using subarray and performing much splicing, but using numeric values.
But we found a problem with splicing multiple text containing vectors together that I don't remember running into before.
I've had success using subarray and performing much splicing, but using numeric values.
Phil999 wrote:if you need a dynamically editable menu, wouldn't it be easier to build one with a container and buttons/text?
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas
Re: menu insert
In my case here, i actually tried it using a switch set to radio mode, and then text objects on top of that,
BUT, my menu has 19 items, and the switch object is hardcoded at a limit of 16 :p
BUT, my menu has 19 items, and the switch object is hardcoded at a limit of 16 :p
Re: menu insert
So if inserting doesn't work currently in-Lemur, you could maybe swap out the menu items with +/- switches...
otherwise what I've always had to do is use a knob/slider and use something like: setattribute(txtStatus,'content',textArray[floor(knobPos.x*maxitems)])
to display what the current synth parameter selection is.
That way you could go up to 256 items.
Checkout the attached example chopped from one of my gear templates..
cheers!
Jay
otherwise what I've always had to do is use a knob/slider and use something like: setattribute(txtStatus,'content',textArray[floor(knobPos.x*maxitems)])
to display what the current synth parameter selection is.
That way you could go up to 256 items.
Checkout the attached example chopped from one of my gear templates..
cheers!
Jay
bananas wrote:In my case here, i actually tried it using a switch set to radio mode, and then text objects on top of that,
BUT, my menu has 19 items, and the switch object is hardcoded at a limit of 16 :p
- Attachments
-
- example-knobSliderUpdateText.jzml.zip
- (3.15 KiB) Downloaded 119 times
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas