3 Replies Latest reply on Aug 3, 2013 4:53 AM by areohbee

    Dynamically updating UI (binding, maybe?)

    allahmane

      So I am writing an export plugin for lightroom. I need to update the export UI dynamically after getting a result from Lrhttp.post. The code is underlined below. Basically, how can I display to the user that their login is successful by dynamically updating the export UI after they click the submit button (I want the last row to display whether the login was a success or not)? I could not find a UI refresh function in the LR API.

       

      I tried looking at Lr.Binding to try to bind resultlogin but that did not work as intended. Any suggestions? Thanks!

       

       

       

       

       

      ExportDialogSections = {}
      
      function ExportDialogSections.sectionsForTopOfDialog(f, propertyTable)
                 return {
                          {
                                    title = "...",
                                    --
                                    f:row {
                                              spacing = f:control_spacing(),
      
                                              f:static_text {
                                                        title =  "Username",
                                                        width = share 'labelWidth',
                                                        alignment = 'right',
                                              },
      
      
                                              f:edit_field {
                                                        value = bind 'Username',
                                                        width_in_chars = 40
                                              },
                                    },
                                    --
                                    f:row {
                                              spacing = f:control_spacing(),
      
      
                                              f:static_text {
                                                        title = "Password",
                                                        width = share 'labelWidth',
                                                        alignment = 'right',
                                              },
      
      
                                              f:password_field {
                                                        value = bind 'Password',
                                                        width_in_chars = 40
                                              },
                                    },
                                    --
                                    f:push_button{
                                              title="Submit",
                                              action = function( button ) 
                                                        import "LrTasks".startAsyncTask( function()
                                                                  resultlogin = LrHttp.post(...) 
                                                        end )
      
                                                        if resultlogin == "success" then
                                                                  --send username to exporttask and display username is valid
                                                                  sendUsername(...)
                                                        else
                                                                  sendUsername(...)
                                                        end
      
                                              end,
                                    },
                                    f:row {
                                              spacing = f:control_spacing(),
      
      
                                              f:static_text {
                                                        title = resultlogin,
                                                        width = share 'labelWidth',
                                                        alignment = 'right',
                                              },
                                    },
                          -- 
                          }
                }
      end
      
      
      
      
      return ExportDialogSections