Copy link to clipboard
Copied
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()
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.