Skip to main content
Inspiring
January 25, 2024
Question

How to get the value of edit_field

  • January 25, 2024
  • 1 reply
  • 155 views

I'm new to creating plug-ins in Lua.

So far i'm using this forum and the Adobe SDK to write my code. 

 

At the moment i'm stuck to get the value back of the edit_field.

My code

 

function ShowDialog()
	LrFunctionContext.callWithContext ("test", function (context)
		local f = LrView.osFactory ()
		local p = LrBinding.makePropertyTable (context)
		p.SourceDir = ""
		local res = LrDialogs.presentModalDialog {
			title = "Set Source directory",
			contents = f:row {
				bind_to_object = p,
				f:static_text {
					title = "Path:",
					alignment = "left",
					width = LrView.share "label_width", 
				}, 
				f:edit_field {
					alignment = 'left', place_horizontal = 0,
					width_in_chars = 50, immediate = true, 
					value = bind "SourceDir"
				},  
			},
			actionVerb = "Save",
		}
	end)
end	
	
		
	
	gij = ShowDialog()

 

 
 
This topic has been closed for replies.

1 reply

Inspiring
January 25, 2024

Solved:

function ShowDialog()
	logger:trace("Dialog box for new config file")
	LrFunctionContext.callWithContext ("test", function (context)
		local f = LrView.osFactory ()
		local properties = LrBinding.makePropertyTable (context)
		properties.SourceDir = ""
		local res = LrDialogs.presentModalDialog {
			title = "Set Source directory",
			contents = f:row {
				bind_to_object = properties,
				f:static_text {
					title = "Path:",
					alignment = "left",
					width = LrView.share "label_width", 
				}, 
				f:edit_field {
					alignment = 'left', place_horizontal = 0,
					width_in_chars = 50, immediate = true, 
					value = bind "SourceDir"
				},
			},
			actionVerb = "Save",
		}
		if res == 'ok' then  LrDialogs.message( properties.SourceDir ) end
	end)
end	
Inspiring
January 25, 2024

I must say that the documentation of Adobe SDK is not quite good.
If you use the examples, they don't work always (yes I have removed the comments)

So it makes it quite difficult to learn this.