Skip to main content
March 11, 2012
Question

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

  • March 11, 2012
  • 1 reply
  • 668 views

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.

This topic has been closed for replies.

1 reply

March 13, 2012

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