10 Replies Latest reply on Oct 18, 2013 5:10 PM by areohbee

    LrView.osFactory:picture  clickable?

    victorvodka Level 1

      I'm generating a filmstrip of pictures in my lightroom plugin and I would like to make them clickable. Is this doable, or do I have to put a button next to each one?  It would be acceptable to have a bunch of buttons with pictures on them, but that doesn't appear to be possible in the SDK.

        • 1. Re: LrView.osFactory:picture  clickable?
          areohbee Level 5

          Do you have the API doc handy? If so, see catalog_photo's mouse_down argument.

           

          (or are you really referring to a 'picture' not a 'catalog_photo').

          • 2. Re: LrView.osFactory:picture  clickable?
            victorvodka Level 1

            i have the doc but i didn't see that because i don't expect it to be in catalog.  i'm also familiar with docs you've put on RobCole.com -- i think they might be a little out of date but you could point me at a URL there.

            • 3. Re: LrView.osFactory:picture  clickable?
              victorvodka Level 1

              but sure enough, if i set mouse_down to be a function, it fires when i mouse_down on a picture!  is mouse_down available on other things created by the LrView.osFactory?

              • 4. Re: LrView.osFactory:picture  clickable?
                areohbee Level 5

                So, to be clear: you ARE using picture, not catalog_photo (previous thread you'd said you were actually using catalog_photo in the filmstrip, I thought - different filmstrip in same plugin perhaps?).

                 

                if picture not catalog_photo, then no: I don't know of a way to make clickable.

                • 5. Re: LrView.osFactory:picture  clickable?
                  areohbee Level 5

                  victorvodka wrote:

                   

                  but sure enough, if i set mouse_down to be a function, it fires when i mouse_down on a picture!  is mouse_down available on other things created by the LrView.osFactory?

                  muouse_down is available (and documented) for static_text, but I never knew it could be used for generic "picture" component - good to know, and worth mentioning as a bug, since it probably should be documented too:

                   

                  http://feedback.photoshop.com/photoshop_family/topics/new

                   

                  I'm not aware of any other components supporting it, but maybe there are...

                   

                  Cheers,

                  Rob

                  • 6. Re: LrView.osFactory:picture  clickable?
                    victorvodka Level 1

                    to be clear, i'm now using catalog_photo as a substitute for picture in my osFactory image display. it was a simple substitution of catalog_photo for picture in the creation of the image in the view.  but now i have another question:  when i render an image this way, how do i tell the mouse_down function what image was clicked on?  here's what my code looks like right now:

                                   pictureStrip[pictureStripCounter]=f:catalog_photo{
                                                                      bind_to_object = dialogData,
                          
                                                   photo=LrView.bind("stripPictures" .. pictureStripCounter),
                                                                      fame_width=2, 
                                                                      width=50, 
                                                                      height=100,
                                                                      mouse_down=function()  
                                                                           myLogger:trace("something got clicked")
                                                                           myLogger:trace(tostring(photo)) 
                                                                           goToImageOnPhoto(photo)
                                                                      end
                                                                      
                                                                      
                                                                 } 
                    
                    • 7. Re: LrView.osFactory:picture  clickable?
                      areohbee Level 5

                      Have you downloaded the latest SDK? There should be an up2date version of all documentation in it. The reason I ask is that the API doc states:

                       

                      mouse_down: (function, optional) Callback for this event, takes one argument, the view object that was clicked.

                       

                      In the description of catalog_photo.

                       

                      So, "what image was clicked on" is passed as a parameter to the mouse_down callback function.

                       

                      Do you see it in the API doc?

                       

                      Anyway, here's an example:

                            local thumbs = catalog:getTargetPhotos()                            
                            local vi = {}
                            for index = 1, #thumbs do
                                 vi[#vi + 1] = vf:catalog_photo {
                                       photo = thumbs[index],
                                       mouse_down = function( this )
                                              LrDialogs.message( tostring( this.photo ) .. " was clicked." )
                                       end,
                                 }
                           end
                           app:show{ info="Click a picture below:",
                               viewItems = vi,
                           }
                      

                      Rob

                      • 8. Re: LrView.osFactory:picture  clickable?
                        victorvodka Level 1

                        I see, so it basically passes back an LrPhoto, which is exactly what i need.  Thanks, as always!

                        • 9. Re: LrView.osFactory:picture  clickable?
                          areohbee Level 5

                          Yeah, basically. Actually, it's the view object itself (i.e. the catalog_photo), so beware - if photo is bound to a dynamic property (of observable table), you'll need a different strategy (e.g. lua closure or lookup table...).

                           

                          Rob

                          • 10. Re: LrView.osFactory:picture  clickable?
                            areohbee Level 5

                            The thread title should say "catalog_photo", since "picture" is not clickable - right? (best to avoid confusion me-thinks)