10 Replies Latest reply: Jul 9, 2009 5:28 PM by Matt Dawson RSS

    static_text change text color on hover/roll over?

    Matt Dawson Community Member

      Hi,

       

      If you have a look at the Export to Facebook plugin by Jeffrey Friedl, its Plugin Info dialog includes static_text items that change colour when the mouse hovers over them.  A while back I posted about initiating an action when a user clicks on a static_text item.  He has used this to inidcate when static_text items are interactive and I want to do this too.  Unfortunately Jeffrey can't talk about it.

       

      Can someone (Eric?) shed light on what field needs to be added to static_text to do this?  I know how to enable left and right mouse clicks on a static_text item but haven't figured out how to react to other mouse events yet.

       

      Thanks,

      Matt

        • 1. Re: static_text change text color on hover/roll over?
          seanmcfoto CommunityMVP

          Matt, would it not be an onHover event? like mouse_hover or similar..

          • 2. Re: static_text change text color on hover/roll over?
            Matt Dawson Community Member

            Seán McCormack wrote:

             

            Matt, would it not be an onHover event? like mouse_hover or similar..

            Have tried mouse_over, text_over, text_hover, text_mouse, mouse_hover and a bunch of others. Hadn't tried onHover but that didn't work either.

             

            Part of the problem is I'm assuming LrColor will be the type being expected by the field. Could be a function that somehow sets the value, or a transform that takes the current mouse event and converts it to a colour.  Too many possibilities and the doco doesn't cover this.

             

            Matt

            • 3. Re: static_text change text color on hover/roll over?
              Mark J M Wilson Community Member

              I was having exactly the same thoughts a few days ago and tried various key names too - decided I'd make do with buttons where I wanted people to click and worry about it when I had more time.

               

              Hopefully someone can nudge us in the right direction...

              • 4. Re: static_text change text color on hover/roll over?
                Matt Dawson Community Member

                Mark J M Wilson wrote:

                 

                Hopefully someone can nudge us in the right direction...

                Eric has let Jon know about this thread.  Think I posted it slightly too late for him to see it today.  Hopefully he can shed some light on this question soon.

                • 5. Re: static_text change text color on hover/roll over?
                  jsteinme Community Member

                  Unfortunately this looks like a situation where we do not have a publicly available API to handle this. Jeffrey is probably using something undocumented. Sorry about that, hopefully we will be able to address this in the next release.

                   

                  I realize this is an unsatisfactory answer but we don't want to publish anything in the SDK until we make sure it is properly tested and not likely to change.

                  • 6. Re: static_text change text color on hover/roll over?
                    Matt Dawson Community Member

                    jsteinme wrote:

                     

                    Unfortunately this looks like a situation where we do not have a publicly available API to handle this. Jeffrey is probably using something undocumented. Sorry about that, hopefully we will be able to address this in the next release.

                     

                    I realize this is an unsatisfactory answer but we don't want to publish anything in the SDK until we make sure it is properly tested and not likely to change.

                    Hi Jon,

                     

                    Thanks for getting back to us.

                     

                    When creating this thread I had expected this was another case of a "documentation bug".  The SDK doco has ambiguities and absences, so it doesn't necessarily follow that having a method/property missing from the doco 100% guarantees that it was intentially unpublished and is not fit for publication.  e.g. LrDialog runOpenPanel's initialDirectory field is missing from the SDK reference, but this field represents a pretty fundamental requirement for any useful open dialog (the ability to specify which directory/file the dialog opens with).  That oversight was addressed in this forum last year.

                     

                    Obviously I can't speak for whether this was intended to be part of the public API.  But I'm hoping your response is based upon what Adobe actually intended to be part public SDK, rather than a hole in the documentation which could be due to a doco bug rather than Adobe's plans or policies.

                     

                    Thanks,

                    Matt

                    • 7. Re: static_text change text color on hover/roll over?
                      john beardsworth CommunityMVP

                      "LrDialog runOpenPanel's initialDirectory field is missing from the SDK reference"

                       

                      Well, well. I was only wondering about this yesterday . Surely the SDK documentation needs to be continually updated wiki style?

                       

                      John

                      • 8. Re: static_text change text color on hover/roll over?
                        Matt Dawson Community Member

                        Hi John,

                         

                        Well, well. I was only wondering about this yesterday  . Surely the SDK

                        documentation needs to be continually updated wiki style?

                         

                        Yes, a community help style approach to the SDK doco could really help resolve this kind of issue, though that would fly in the face of the "it's not in the SDK doco so it's not in the SDK" position.

                         

                        Alternatively we need our own place to include our own supplemental material.  Have been toying with the idea of adding something to my site for this.  Just don't want to turn my whole site into a shrine to LR plugin coding just yet and need to find a good way to maintain that balance.

                         

                        Matt

                        • 9. Re: static_text change text color on hover/roll over?
                          Don McKee Community Member

                          WARNING:  What you'll see here is undocumented, unsupported, could break at any time, should not be used to control critical functions like landing airplanes, yada, yada, etc., etc.  Use at your own risk -- it's up to you to make it work.  I have no recollection of ever typing this, so can't be held accountable.

                           

                          Phew!  Anyway, a couple of months ago, I asked Jeffrey Friedl the same question.  His reply:

                           

                          I asked for (and was given) permission to tell you:

                           

                               f:static_text {
                                   title = 'Visit Site',
                                   mouse_down = function()
                                      LrHttp.openUrlInBrowser( someUrl )
                                   end,
                                   [ WIN_ENV and 'adjustCursor' or 'adjust_cursor' ] = function()
                                      logger:debug('mouse_over handler activated')
                                   end,
                                   text_color = LrColor( 0, 0, 1 ),
                               }       

                           

                          Enjoy!

                           

                          When asked if I could share the information, he replied:

                           

                          The permission didn't come with any restrictions, so I guess it's okay to
                          spread around.

                           

                          Anyway, the critical part of the code snippet that's missing is what to do in the "mouse_over handler" function.  What I did for all of my links was to call a common function that would launch an async task that would change the color of the link, then change it back after a period of time.

                           

                          I passed "self" (the static_text being hovered over) to my common routine so it could keep track of the active link, and reset the previous link when the user hovers somewhere new.

                           

                          Good luck, and, as Jeffrey said, Enjoy!

                           

                          -Don

                          • 10. Re: static_text change text color on hover/roll over?
                            Matt Dawson Community Member

                            Thanks Don.

                             

                            It sounds like a little too much effort (and risk) to be worth it for that slight UI improvement, but its nice to have my curiousity satisfied!

                             

                            Matt