Copy link to clipboard
Copied
I managed to display a table with rows and column using the LrDialogs.presentModalDialog.
All the values from the orginal table I converted to a flat property table.
propertyTable = LrBinding.makePropertyTable(context)
Before adding the new row I display the table. This works fine
Ofcourse variable "c" contains all groups, rows and columns.
dialogValue = LrDialogs.presentModalDialog(
{
title = "My table",
contents = c,
}
Having my original table and a flattened projection of it as property table, below the table rows I added a button.
The button calls a function which performs the steps below:
LrDialogs.stopModalWithResult(dialogValue)
dialogValue = LrDialogs.presentModalDialog(
{
title = LOC "$$$/LightroomStatistics/Dialogs/Translations=Translations",
contents = c,
}
)
Question
How can I redraw / redisplay the modal form.
Here's an example of how to change the controls displayed dynamically (see the attached screen recording):
local LrDialogs = import "LrDialogs"
local LrView = import "LrView"
local f = LrView.osFactory ()
local nRows = 1
while true do
local rows = {spacing = f:control_spacing ()}
for i = 1, nRows do
table.insert (rows, f:static_text {title = "Row " .. i})
end
table.insert (rows, f:push_button {title = "Add row",
action = function (button)
nRo
...
Copy link to clipboard
Copied
Here's an example of how to change the controls displayed dynamically (see the attached screen recording):
local LrDialogs = import "LrDialogs"
local LrView = import "LrView"
local f = LrView.osFactory ()
local nRows = 1
while true do
local rows = {spacing = f:control_spacing ()}
for i = 1, nRows do
table.insert (rows, f:static_text {title = "Row " .. i})
end
table.insert (rows, f:push_button {title = "Add row",
action = function (button)
nRows = nRows + 1
LrDialogs.stopModalWithResult (button, "refresh")
end})
local result = LrDialogs.presentModalDialog {title = "Test",
contents = f:column (rows)}
if result ~= "refresh" then break end
end
Copy link to clipboard
Copied
This works great, you put me on track again.
Since I work with scrolled_view, I modified the code a little and now works also.
Simply replacing f:columns(rows) by f:scrolled_view(rows) didn't work.
while true do
local outerRows = {}
local rows = {}
outerRows = { spacing = f:control_spacing() }
for i = 1, nRows do
table.insert(rows, f:static_text { title = "Row " .. i })
end
table.insert(outerRows, f:scrolled_view(rows))
table.insert(outerRows, f:push_button { title = "Add row",
action = function(button)
nRows = nRows + 1
LrDialogs.stopModalWithResult(button, "refresh")
end })
local result = LrDialogs.presentModalDialog { title = "Test",
contents = f:column(outerRows) }
if result ~= "refresh" then break end
end
Copy link to clipboard
Copied
I am writing a plugin for Lightroom in which the user can select multiple metadata fields to have "remapped" to different values upon export of an image. I'd like to give them a UI to specify which field will be updated, and how they would like to update it, but I do not know ahead of time how many metadata fields they would like to edit. Is there a way to use an "add row" button which, when clicked, will add a new row to the UI for them to specify these details for another metadata field?
I know about the LrBindings namespace and that it can be used to dynamically update properties of different UI elements (like the visibility property or the contents of a text field) but is it possible to create entirely new UI elements with a button as well?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Moderators, @Rikk Flohr: Photography, please merge with this thread: