Skip navigation
Currently Being Moderated

Binding problem in LrPluginInfoProvider.sectionsForBottomOfDialog

Jun 24, 2009 3:03 PM



I have a binding problem in my LrPluginInfoProvider.sectionsForBottomOfDialog function, and i cannot make it work; i've read all the docs, view all the samples, but i just can´t see where the problem is ...


I have this code in my Info.lua


return {


     LrPluginInfoProvider = 'PluginInfoProvider.lua',




PluginInfoProvider.lua has this code:


require 'PluginManager'


return {
    sectionsForBottomOfDialog = PluginManager.sectionsForBottomOfDialog,


And this is PluginManager.lua:


local LrView = import 'LrView'
local LrDialogs = import 'LrDialogs'
local LrLogger = import 'LrLogger'


local myLogger = LrLogger('logger')


PluginManager = {}


function PluginManager.sectionsForBottomOfDialog(viewFactory, propertyTable)


    propertyTable.text = ""
    propertyTable.buttonEnabled = false


    return {
            title = "Test",
            viewFactory:row {
                spacing = viewFactory:control_spacing(),
                viewFactory:static_text {
                    title = LOC "Text",
                viewFactory:edit_field {
                    value = LrView.bind "text",
                    validate = function( view, value )
                        if #value > 0 then -- check length of entered text
                            propertyTable.buttonEnabled = true
                            propertyTable.buttonEnabled = false
                        return true, value
                viewFactory:push_button {
                    enabled = LrView.bind 'buttonEnabled',
                    action = function(button)
                            myLogger:trace("Test value")


As far as i know, the button should enable only when there is some info in the text field and log file should show the text field value, but it only displays "Test value" and the button is always enabled.


Any idea? i'm really with this ... (i don't know if matters, but i'm testing this in a WinXP machine with LR 2.3)


Thanks in advance,

  • Currently Being Moderated
    Jun 25, 2009 1:32 AM   in reply to K3k0

    It looks like you need to tell the controls which property table to bind to.


    In this code, try adding "bind_to_object = propertyTable," to the row.


    To make the button enable as soon as there is more than 0 chars in the textbox, add "immediate = true," to the edit_field.  This will run the validate function as the user types.

    Mark as:
  • Currently Being Moderated
    Jun 25, 2009 7:50 AM   in reply to K3k0

    As you have figured out, the value of the edit_field will not change until it is validated and it will only be validated with every keystroke when "immediate = true".


    Another way to accomplish this would be to bind the enabled state of the button to the value of the edit field. Such as:


    enabled = LrView.bind {

         key = "text",

         transform = function( value, fromTable )

              if fromTable then

                   if value ~= nil and value ~= "" then

                        return true


                   return false





    (This was not tested but should be close)


    The advantage of this is that the button will be enabled and disabled without the validation of the edit_field needing to be called. So if the value of the text field is changed programatically the button will be updated.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points