Dynamic Sub ComboBox
-
Hi fellas,
I think I know the answer to this question, but I might have overlooked something.
I'll ask anyway: is it possible to add items dynamically to a combobox which has submenus - and have the menu being 'rebuilt' correctly?From what I've tried, the combobox entries are not correctly rendrered:
HiseSnippet 958.3ocsV0saaaCElzIpaRaqnEnWOH3qTvBBryZ6F5Pwxri8fwpSMlaK1tXnfQ5XKhHQJPRkFgg7FsGh8Hs2fsCkjskqcScMvzEF9im+934OoIJYHn0REg59phLfP+RmoEBSb+XFWPFcNgdemwLsAT9UG0qHio0PDgRO3msGPcOjT97O+XOVBSDBqNhPdijGBufmxMqNcxY+BOIYHKBdEOsg1O9rQgRQeYhLG4yANcHYrvqXygKXV0Z4Pn2aPD2HUSMLCnQc5IiJlFKemnR+2v07KS.KnKYJ5npiI8i4IQSVbW0DB8vIqt4GTcyejyXdDe44qx.OnTf+JKZlCnstKJ08SfRzFT5vJJ8PmogJdlYkDKe9BmQBrfLigo5lToRWRq+pkSeIpgvbRJ6JXnBAKsH3oc5brO9yQ+fmGlt0F+qYXwUldorm7lt9O2egwyACdblTfff1K0nMZ4RvIZ.kwMPpt8w9sWWFKJZDJIn8PtRad1yZ6+M9sGHLpht6phm9ATbJfbOZWb4lZ9g74q0fZCO5wEIbA3OKWDZ3RguTzK2Xjht1zjRlDDtHGcLlISxgi79SOW9rfZfKhbuynMlYhOQwDQXQJ.KNcwhCFY2a8tEi+1qF0bn8Q1BPMS5yRRtDmXBdeJhNqA8uPZfWJBJoo2sd9uunYy1prZek.psJ1NJqtKCCD4oWBplIIqhXu95CP2a2FfBqRKMTTJFI3lWlA03gxjH6fg8+aNtQpyq1AuZFhpZJG6dP8X2hpFgGYm5VVDIkWgla9Hudz4LCagyP+hwJCTFt8JQOGtFWCVMS65bNnuxHyvMZKKnD5msig9FB0g9GXPKV7mbMzOWajoSjY4nWosJGGIzQNd0ySUsyqgN0awfQsv0fm5U0dVIijxJCqCoLusjytUb990btpoqjwtN0cfV9tHM86mUrD72yO6c7HSr0s2f3XfOO1XQeMhzrqgQhIJ.atsa135wxTLjLUg89ABF1QXWJ+BfoDVMHat7DWaKixSXl02kaeoUs.r+bsEn1kjBM2Tzrz9IrfuyctfeWo3CclvMgwamis1BGwtt+O3X8qE+JmAylAglUD7Pmg+199NvOR3+UYtgKliaDUbaK2E4oSwuFHDvnKDPh11gzx1EVg6Xw1LvTPDUB9W7oVXWKlVKr6BgXybnR91vpYd6Kd+7xSPNIJ+NCW7CdPr+Fi4DRJ1x81vv0c0FFd59Z32tuF9380vmruF9z80vuaeM76+3FZ2H7S43lvpwFBY7jAkqkozAkqLJ6VI+GceYEiC
-
@Matt_SF Bumping. Just in case...
-
@Matt_SF It looks like the addItem function doesn't parse the :: so I think it's being rebuilt as string values.
EDIT.... scratch that. I forgot popup menus are used for combos that have sub menus.
-
yes you have to go through the
combobox.set("items", itemList)
call, but then it should work with sub menus (as long as theuseCustomMenu
property is true). -
@Christoph-Hart @Dan-Korneff Thanks, but unfortunately it's still not working.
If I use
combobox.set("items", itemList)
:
The console returns :You must specify the unique component name, not the object itself
.And any other way of adding the new item I could think of, ends up in the menu becoming a single menu filled with the entries written as strings... :confused_face:
The
useCustomMenu
property is correctly set to true.Edit :
HiseSnippet 1143.3ocsVstaaaCElxIZcxaqnEXO.D9O0YKK0J2baF5lWbh2LVbqQcurhhtBZIJKtHQpQRkVig7tsGo8FrcnjrjbhyVgwp9gfNGdt7cN7vOpwRgGUoDRjUymMOghr9b6Iy45v9gDFGM7Dj0ssGQTZpDmq534IDkh5irr13GMJrb1Dk87We+wjHB2iVoBgdgf4QOiEyzUZG26mYQQCH9zmwhqY898F5I38EQhT.OaX2AkP7NmLi9XhwrF1nehnBQVek8CO3.WheP2.28be3T+.O5dc6b39c2kbvCBB51wc+876FrO.xO4TelVHmnIZpBYs4wB+4SBEuimmfWvTroQTifKZBj4b0CDQ9lRznE0OjE4OdQiRgfnLtpssQda6KsGw7Yk5qZe2IaAbkG0afVMVFdarD7bqCuN0f2JfjUMHsYNjtq8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SynLxlVQ+ip7kUy
-
@Matt_SF you need to pass in a string with one line per item, not the array. Just use
ComboBox1.set("items", itemList.join("\n"));
and it will work. However I noticed it doesn't :) Let me check real quick why it isn't the case, it normally should parse it when you change this property...
-
@Christoph-Hart Perfect, it's working now with your fix. Thank you very much!
ComboBox1.set("items", itemList.join("\n"));
Yeah, I almost never use this method, I didn't thought about it. Thank you also for the reminder :)