Skip to main content
Participating Frequently
March 19, 2025
Question

simple_list is unusable

  • March 19, 2025
  • 1 reply
  • 225 views

I have found following problem with simple_list:

 

I have popup_menu:

f:popup_menu {
	value = bind 'inputSwitch',
	items = {"web", "json", "csv"},
},


a transform function:

local function isWebSelected( val, fromModel )
	if "web" == val then return true
	else return false end
end

 

and a simple_list wich is enabled, when the "web" is selected:

f:simple_list{
	value = LrView.bind{ key = 'selectedSession' },
	items = LrView.bind{ key = 'webSessions' },
	visible = LrView.bind{ key = 'loginStatus' },
	enabled = LrView.bind{ key = 'inputSwitch', transform= isWebSelected },
	allows_multiple_selection = false,
},

 
and although simple_list properly switches state from enabled/disabled - when I enable it - it's unusable - not able to scroll or select anything.

but when I change this binding to something else, like:

local function isJsonSelected( val, fromModel )
	if "json" == val then return true
	else return false end
end

enabled = LrView.bind{ key = 'inputSwitch', transform= isJsonSelected },

 
then it works fine (except for the logic)

1 reply

johnrellis
Legend
March 20, 2025

Can you post a full self-contained .lua script showing the problem? 

zuber1979Author
Participating Frequently
March 21, 2025
local function isWebSelected( val, fromModel )
	if "web" == val then return true
	else return false end
end

local function getSessions(sessions)
	local guisessions = {}
	for idx, val in pairs(sessions) do
		table.insert(guisessions, {["title"] = val["name"], ["value"] = "box"..idx })
	end

	return guisessions
end

function ExportDialogSections.sectionsForBottomOfDialog( f, propertyTable )

	local result
	local bind = LrView.bind
	local webView = nil

	propertyTable.selectedWebSessionURL = nil

	LrFunctionContext.postAsyncTaskWithContext( "fetchSessions", function( context )
			local err = Html.extractGaleries()
			if err then LrDialogs.message( "HTTP error: ", err )
			else
				webSessions = Html.getSessions()
				propertyTable.webSessions = getSessions(webSessions)
			end
		end
	end )

	local result = {
			{
		
				title = LOC "$$$/ExportDialog/settings=Settings",

				f:row {
					f:popup_menu {
						value = bind 'inputSwitch',
						items = {"web", "json", "csv"},
					},
				},

				f:column {
					f:row {

					f:simple_list{
						value = LrView.bind{ key = 'selectedWebSession' },
						items = LrView.bind{ key = 'webSessions' },
						visible = LrView.bind{ key = 'loginStatus' },
						enabled = LrView.bind{ key = 'inputSwitch', transform= isWebSelected },
						allows_multiple_selection = false,
					},
				},

		}
	
	return result
	
end
zuber1979Author
Participating Frequently
March 22, 2025

it started to work correctly, when I moved update of simple_list items to startDialog() function.