1 Reply Latest reply on Mar 12, 2012 5:16 PM by clvrmnky

    Cannot bind a property to the value of an LrView:picture

    clvrmnky Level 4

      Per this discussion, I wonder of there is a bug binding specific properties to viewFactory:picture()

       

      I can't seem to bind the value, even with a hacky transform that logs and returns a string. This snippet is from a sectionsForTopOfDialog() callback, with the keys we want in that property table passed in.

       

      f:picture {
                               value = bind {
                                    key = 'pic',
                                    transform = function ( value, fromModel )
                                         local res = _PLUGIN:resourceId( value )
                                         tracef(" Will return: %s", res)
                                         return res
                                    end,
                               },
                               tooltip = bind 'picTT',
                          },
      

       

      The tooltip works (so far) but I can't get resource to show up. I tried a variety of ways of getting the string into the value. It seems like you can't bind properties to this value.

        • 1. Re: Cannot bind a property to the value of an LrView:picture
          clvrmnky Level 4

          Sometimes I question how deterministic the SDK is. This just started working for me:

           

          f:picture {
                                   value = bind {
                                        key = 'accountIcon',
                                        transform = function ( value, fromModel )
                                             if not fromModel then return LrBinding.kUnsupportedDirection end
                                             
                                             --tracef(" value=%s", value)
                                             
                                             return _PLUGIN:resourceId( value or PluginDefs.defaultAccountIcon )
                                        end,
                                   },
                              },
          

           

          I'm afraid to change anything now. There is a timing issue between the table observers in the callback and the thing that sets the properties I can't quite grok