Skip to main content
Inspiring
January 25, 2024
質問

How to get the value of edit_field

  • January 25, 2024
  • 返信数 1.
  • 155 ビュー

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()

 

 
 
このトピックへの返信は締め切られました。

返信数 1

patrick_marq作成者
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	
patrick_marq作成者
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.