4 Replies Latest reply on May 1, 2014 3:09 PM by areohbee

    Problem with startAsyncTask to fill value into popup_menu items


      Hi everybody,


      I encountered a problem to fill the popup_menu items with a startAsyncTask function.


      This is my function:


      function getLabelColor(propertyTable)
                local catalog = LrApplication:activeCatalog()
                local labelColor = catalog:getLabelMapToColorName()
                propertyTable.label_red = getKeyForValue(labelColor, "red") -- getKeyForValue return the key for the value
                propertyTable.label_green = getKeyForValue(labelColor, "green")
                propertyTable.label_yellow = getKeyForValue(labelColor, "yellow")
                propertyTable.label_blue = getKeyForValue(labelColor, "blue")
                propertyTable.label_purple = getKeyForValue(labelColor, "purple")


      I run the async task on sectionsForTopOfDialog:


      function exportServiceProvider.sectionsForTopOfDialog(f, propertyTable)
                LrTasks.startAsyncTask(function ()
                return MLDialogs.settings(f, propertyTable)


      On my MLDialogs.settings function I've this:


      f:popup_menu {
           title = LOC "$$$/ML/ExportManager/ASLabel=Color label for Dual ISO file :",
           items = {
                 { title = "", value = "" },
                 { title = propertyTable.label_red, value = "red" }
                   { title = propertyTable.label_yellow, value = "yellow" },
                { title = propertyTable.label_green, value = "green" },
                { title = propertyTable.label_blue, value = "blue" },
                { title = propertyTable.label_purple, value = "purple" },
           value = bind "label",
           size = 'small'


      When I run the plugin, it display the value from the color label, but if I change the values for the color, when I run the plugin, the display values is the old (but on the log I've the new, so the title isn't refreshed).


      I found that the async function return value after sectionsForTopOfDialog is displayed.

      I try to change title = propertyTable.label_red to title = bind 'label_red' but I've an error:


      Invalid parameter not satisfying: aString != nil


      you can found the source here https://bitbucket.org/kichetof/lr_cr2hdr/src


      I hope you can help me!