umenu and coll
Hi Maxers !
I'm using an [umenu] and I know it has a feature to autopopulate and a "prefix" attribute/message which allows to autopopulate from a folder for example.
And I was wondering if there's a way to autopopulate the [umenu] directly from a [coll]. I have one good reason to do that : in a [coll], you can retrieve an element with a symbol. Thing you cannot do (as far as I know) with a [umenu]. So it would be very nice to have my [umenu] always in sync with my [coll].
Do you know how to do something like this ?
Thank's
There's quite a few messages the can be used to fill umenu dynamically. First 'clear' the umenu, 'dump' the content of coll and 'append' each item in the menu. The umenu can by the way be search using symbols. I believe that set does this, but check the reference for that.
Hi !
Yes, actually you can access the menu items with their names using the message "symbol" followed by the name of the item. But my main problem is that you cannot do the same to delete an item. I have a system which populates and deletes [umenu] items when launching and closing patches. And each patch is identified by its name. But in the [umenu] you need to know the item number (ie. the order of appearance of the patches) to be able to delete the item. This is where I use the [coll]: to keep somewhere the association between a name and the item number.
I did managed a way (with "append", you're right and other messages) to keep manually the [umenu] and the [coll] in sync. But I was wondering if there was some more elegant way to do it ;o)
I'll post my patch soon. Maybe it will be useful for a maxer to take it as it is and don't bother rebuilding such a sync.
Cheers
You could grab the info from the menu to retrieve the item number.
like for most things on this world i have an abstraction for that.
Glad to see others do this: a patch very similar to Roman's is in my commonly used clippings...very useful!
The question: will it work with the new Live menus in Max4Live?
We shall see.
(or someone will let us know, whichever comes first.)
l&k
j2k
I am also working on something very similar. I would be very interested in seeing how you did the management of umenu and coll together!
try this
----------begin_max5_patcher----------
{
"patcher" : {
"fileversion" : 1,
"rect" : [ 202.0, 75.0, 1024.0, 798.0 ],
"bglocked" : 0,
"defrect" : [ 202.0, 75.0, 1024.0, 798.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"boxes" : [ {
"box" : {
"maxclass" : "message",
"text" : "read rythmicVals",
"patching_rect" : [ 270.0, 174.0, 88.0, 15.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"fontsize" : 9.0,
"hidden" : 1,
"outlettype" : [ "" ],
"id" : "obj-1",
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "loadbang",
"patching_rect" : [ 305.0, 33.0, 48.0, 17.0 ],
"numinlets" : 1,
"numoutlets" : 1,
"fontsize" : 9.0,
"hidden" : 1,
"outlettype" : [ "bang" ],
"id" : "obj-2",
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "clear",
"patching_rect" : [ 319.0, 143.0, 33.0, 15.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"fontsize" : 9.0,
"hidden" : 1,
"outlettype" : [ "" ],
"id" : "obj-3",
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "dump",
"patching_rect" : [ 262.0, 116.0, 33.0, 15.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"fontsize" : 9.0,
"hidden" : 1,
"outlettype" : [ "" ],
"id" : "obj-4",
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t b b",
"patching_rect" : [ 261.0, 63.0, 30.0, 17.0 ],
"numinlets" : 1,
"numoutlets" : 2,
"fontsize" : 9.0,
"hidden" : 1,
"outlettype" : [ "bang", "bang" ],
"id" : "obj-5",
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "outlet",
"patching_rect" : [ 192.0, 310.0, 15.0, 15.0 ],
"numinlets" : 1,
"numoutlets" : 0,
"hidden" : 1,
"id" : "obj-6",
"comment" : ""
}
}
, {
"box" : {
"maxclass" : "inlet",
"patching_rect" : [ 213.0, 91.0, 15.0, 15.0 ],
"numinlets" : 0,
"numoutlets" : 1,
"hidden" : 1,
"outlettype" : [ "" ],
"id" : "obj-7",
"comment" : ""
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "append $1",
"patching_rect" : [ 247.0, 357.0, 55.0, 15.0 ],
"numinlets" : 2,
"numoutlets" : 1,
"fontsize" : 9.0,
"hidden" : 1,
"outlettype" : [ "" ],
"id" : "obj-8",
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "gswitch2",
"patching_rect" : [ 288.0, 269.0, 39.0, 32.0 ],
"numinlets" : 2,
"numoutlets" : 2,
"hidden" : 1,
"int" : 1,
"outlettype" : [ "", "" ],
"id" : "obj-9"
}
}
, {
"box" : {
"maxclass" : "umenu",
"patching_rect" : [ 0.0, 22.0, 100.0, 17.0 ],
"presentation" : 1,
"numinlets" : 1,
"labelclick" : 1,
"numoutlets" : 3,
"fontsize" : 9.0,
"outlettype" : [ "int", "", "" ],
"items" : [ "sixteenth", ",", "eighth_triplet", ",", "eighth", ",", "eighth_iamb", ",", "sixteenth_iamb", ",", "eighth_troche", ",", "rhythm1", ",", "rhythm2", ",", "rhythm3", ",", 1, ",", 2, ",", 3 ],
"presentation_rect" : [ 12.0, 18.0, 103.0, 17.0 ],
"types" : [ ],
"id" : "obj-10",
"fontname" : "Arial"
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "coll rythmicVals",
"patching_rect" : [ 240.0, 210.0, 72.0, 17.0 ],
"numinlets" : 1,
"numoutlets" : 4,
"fontsize" : 9.0,
"hidden" : 1,
"outlettype" : [ "", "", "", "" ],
"id" : "obj-11",
"fontname" : "Arial",
"saved_object_attributes" : {
"embed" : 0
}
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-8", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-2", 0 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-2", 0 ],
"destination" : [ "obj-1", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-5", 1 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 1 ],
"destination" : [ "obj-9", 1 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 3 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 1 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-4", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-7", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-6", 0 ],
"hidden" : 1,
"midpoints" : [ ]
}
}
]
}
}
-----------end_max5_patcher-----------
could you post the patch above with copy compressed? For some reason when i try to load this patch it crashes max!?
hey, thanks bwagner.. that is just what the dr. ordered.