7 Replies Latest reply: Jun 12, 2012 2:47 PM by areohbee RSS

    Responding to clicks on viewFactory:picture()?

    johnrellis MVP

      Is there a way to make a picture created with viewFactory:picture() clickable?  :static_text() has the mouse_down property, but :picture() doesn't seem to recognize that. I thought I demoed a plugin that had clickable icons, but I can't find that anymore.  Am I missing something obvious?

        • 1. Re: Responding to clicks on viewFactory:picture()?
          areohbee Community Member

          johnrellis wrote:

           

          Is there a way to make a picture created with viewFactory:picture() clickable?  :static_text() has the mouse_down property, but :picture() doesn't seem to recognize that. I thought I demoed a plugin that had clickable icons, but I can't find that anymore.  Am I missing something obvious?

           

          I wouldn't mind having clickable pictures either. And, if there was some way to make it evident, that would be even better (e.g. rollover cursor change) - same goes for static text.

           

          John - if you ever run across a plugin with clickable pictures let me know - I'll do the same.

          • 2. Re: Responding to clicks on viewFactory:picture()?
            clvrmnky Community Member

            Here's a hack:

             

            Use place = 'overlapping' and combine two LrView elements on top of each other.

             

            A cheesy example:

             

                           f:row {
                                place = 'overlapping',
                                
                                f:picture {
                                     value = _PLUGIN:resourceId( 'fnord.gif' ),
                                },
                                
                                f:static_text {
                                     -- A block of overlapping transparent text. Adjust for image size.
                                     title = "01234567890123456789012345678901234567890123456789",
                                     height_in_lines = -1,
                                     width_in_chars = 10,
                                     text_color = LrColor(),
                                     mouse_down = function(view)
                                          LrFunctionContext.postAsyncTaskWithContext('Fnord',
                                          function(context)
                                               LrDialogs.message( 'Fnord', nil, 'info' )
                                          end)
                                     end,
                                },
            

             

            Works for me. The overlapping text block might be stupid overkill -- I never looked deeper into this.

            • 3. Re: Responding to clicks on viewFactory:picture()?
              johnrellis MVP

              Clever, thanks.

              • 4. Re: Responding to clicks on viewFactory:picture()?
                clvrmnky Community Member

                Oh man, last night I had the awful, terrible idea that you might be able to use this technique to create sort of a fake HTML image map, and have various clickable areas of carefully overlapped invisible (or not, as you would) text that responds in different ways. (Assuming the size of the text title actually means anything. It looks like even a title of "" is clickable across the entire image. Just as well, I suppose.)

                • 5. Re: Responding to clicks on viewFactory:picture()?
                  jarnoh Community Member

                  Thanks for the placement="overlapping" tip, I had forgotten it totally! 

                   

                  Some time ago I was experimenting with a face detection plugin (sometime that merely counts the faces, I'd like to use it to classify photos into human/non-human), but back then I could'nt figure out a way to properly show detected face regions from the plugin, because I wasn't able to get components overlapping.  catalog_photo with overlapped group_box and static_text seem to offer just what I want.  Actually, with click support, it could probably be used to classify the faces as well...

                  • 6. Re: Responding to clicks on viewFactory:picture()?
                    jarnoh Community Member

                    I've now created new plugin, which is relying on the overlapping placement of controls.... only to find out that it does not work on Windows!

                     

                    On Windows, only the first item is visible or clickable, tested on LR4.1. 

                     

                    I'm seriously thinking about going for 100% Mac, but there's still the 50% users who have Windows...