P: Problem with LrView:combo_box and binding for items
Hello,
I try to use a combo_box with a binding for the items:
local function main()
LrFunctionContext.callWithContext('showDialog', function(context)
local props = LrBinding.makePropertyTable( context )
props.items = { '1', '2', '3'}
props.value = ''
logDebug('main', '#Items = ' .. #props.items )
local f = LrView.osFactory()
local view = f:column {
bind_to_object = props,
f:row{
f:combo_box{ items = LrView.bind('items'), value = LrView.bind('value'), width = 50 },
f:push_button{
title = 'Remove',
action = function()
if #props.items > 1 then table.remove(props.items, #props.items ) end
logDebug('main', 'After remove #Items = ' .. #props.items )
end,
},
},
}
status = LrDialogs.presentModalDialog {
title = 'test combo box',
contents = view,
}
end )
end
Initially all three items are displayed. By pressing the 'Remove' button the last item is removed from the item table, but still all three items are displayed. After selecting the last (non-existing) item Lightroom crashes.
Any ideas what's the code?
Regards. Roland
