Skip to main content
Inspiring
August 6, 2025
Answered

Trying to persist a dialog value using LrPrefs

  • August 6, 2025
  • 1 reply
  • 157 views

I'm trying to set up a simple dialog with an edit field the value of which persists using the code below, called using  LrPluginInfoProvider in my info file. What am I doing wrong?

local LrView = import "LrView"
local LrPrefs = import "LrPrefs"
local LrDialogs = import "LrDialogs"
local bind = LrView.bind
local pluginInfoProvider = {}

function pluginInfoProvider.sectionsForTopOfDialog(f, properties )
	local prefs = LrPrefs.prefsForPlugin( )    
	if properties.userName == nil then
		properties.userName = prefs.userName or "yyyy"
	end

	return {
		{
			title = "Chatter Preferences --",
			synopsis = "Chatter, by Kim Aldis",

			f:row {
				f:column {
					spacing = f:control_spacing(),
					f:static_text {
						title = "Testing:"
					},
					f:edit_field {
						value =  bind "userName",
						width = 300
					}

				}
			}
		}
	}
end

return pluginInfoProvider
Correct answer johnrellis

I think you may need to set the "bind_to_object" property of the returned controls:

 

f:row {bind_to_object = properties,
    f:column {
        spacing = f:control_spacing(),
        ...

 

1 reply

johnrellis
johnrellisCorrect answer
Brainiac
August 6, 2025

I think you may need to set the "bind_to_object" property of the returned controls:

 

f:row {bind_to_object = properties,
    f:column {
        spacing = f:control_spacing(),
        ...

 

kimaldisAuthor
Inspiring
August 6, 2025

And as if by magic ...

 

Thanks John.