Not sure if this is a bug, but thought I`d mention it here.
If you change the .items for a popup to a table of fewer total values AND the popup is selecting a value greater than the number of new items. The popup .value remains at a now non existant value and the popup shows the default “None” entry until changed manually.
You might expect the value would default to 1 or 0 or nil?
DEMO CODE, works in testpad
–here we reduce the number of popup items from 3 to 2 while 3 is selected. 3 remains as selection value even though it doesn`t exist.
--global variables for gui
local my_dialog = nil
local vb = nil
--assign global vb to viewbuilder
vb = renoise.ViewBuilder()
local items = {"1","2","3"}
local main_column =
vb:column{
vb:popup{
id = "popup",
items = items,
value = 3,
}
}
local dialog_content = main_column
--Show Script dialog
my_dialog = renoise.app():show_custom_dialog("Test Popup", dialog_content)
--Now make a new table with one less item
local less_items = {"1","2"}
--update popup to have one less item
vb.views["popup"].items = less_items
--print the popup value
print(vb.views["popup"].value)
--this prints that the popup is still at its original value of 3.
--Also the popup shows the default entry "None" until it is changed by the user or script.