Here what I can manage to string together about comboboxes that list a bunch of files:
- When selected they return only the file name and extension, i.e, no path
- To update an item in said combobox you need to set the text as it will appear in the combobox
- this is a little annoying I have to say - but it can be worked around.
Iāve attached a full example that will work as I think you would expect. Hereās a run down of the best bits
SFileType cabbageGet "combo1", "fileType" ; get file type as set by populate()
SPath cabbageGet "combo1", "currentDir" ; get the directory that is passed to poplate()
SCsdPath cabbageGet "CSD_PATH" ; get .csd directory
SFilesDir sprintf "%s/%s/", SCsdPath, SPath ; construct full path from absolute and relative paths
SFile, kComboChanged cabbageGetValue "combo1" ; get file name
SFileName cabbageGetFileNoExtension sprintfk("%s/%s", SFilesDir, SFile) ;get filename from full name
The code above constructs paths from the relative ones given to populate() and the absolute path that CSD_PATH
returns. Changing to a different folder wonāt break this, as long as you keep things relative. Iām also removing the file extension from the combobox return string. I add it later, itās safer to do this.
if kSliderTrig == 1 then
;update combo and set current file
cabbageSetValue "combo1", sprintfk("%02d", kSlider), kSliderTrig
chnset sprintfk("%s%02d%s", SFilesDir, kSlider, strsubk(SFileType, 1, -1)), "currentFile"
endif
Here I set the combobox item to match the slider value, and then update the new ācurrentFileā channel.
Itās a bit of a hoop, but it works
comboTest.zip (76.4 KB)