5 Replies Latest reply on Feb 14, 2013 10:24 PM by areohbee

    Now possible to scroll line-wrapped output in window of ModalDialog?

    snahphoto

      Hello,

       

      At some point the plugin I am working on must display a window with extracted values (varPathName), in this case the full-path-names to image files.

      Depending on the users selection there are many or only a few full-path-names in the output.

      The output is one line that wraps within the given width of the window and should remain so.

      No problem for adjusting the height of the window by calculating the value for the variable 'outputlines'.

      But sometimes there might be more output than available space inside the window (full height on the screen). Therefore I would like to have a scroll-bar on the right side of the window.

      How can this be achieved given the code below. Is it possible to create a scroll-bar after all?

       

      local f = LrView.osFactory()
           local c = f:row{
                bind_to_object = props,
                     f:column {
                          f:edit_field {
                               value = varPathName,
                               width_in_chars = 80,
                               height_in_lines = outputlines
                          },
                     },
           }
           dialogValue = LrDialogs.presentModalDialog({
                title = "extracted Paths and File Names" ,
                contents = c,
           })
      

       

      Feedback is much appreciated.

       

      (reference: http://forums.adobe.com/message/3190135#3190135)

       

      Message was edited by: snahphoto

        • 1. Re: Now possible to scroll line-wrapped output in window of ModalDialog?
          areohbee Level 5

          Lr4 has scrolled_view, but of course your plugin will no longer by Lr3 compatible if you're depending on it.

           

          One Lr3-too option is to use an edit_field, which auto-scrolls. you'd need height_in_lines = math.min( outputlines, some-number ).

           

          There won't be a scroll bar - no way to do it in Lr3-compatible fashion, without (what I assume is a lot of) work. Jeffrey Friedl did it but I have no idea how.

           

          Rob

          • 2. Re: Now possible to scroll line-wrapped output in window of ModalDialog?
            snahphoto Level 1

            Thanks Rob,

             

            so the output gets saved to a file in the system-temp folder and then opened in an editor.

            Like this:

             

            communicatorFile = LrFileUtils.chooseUniqueFileName(LrFileUtils.chooseUniqueFileName( LrPathUtils.child(LrPathUtils.getStandardFilePath("temp"), "FilesPathsList_string.txt")))

            local createFile = assert(io.open(communicatorFile,"w+"))

                 createFile:write(varPathName)

                 createFile:close()

            fileToOpen = string.format("%q", communicatorFile)

            LrShell.openFilesInApp( { fileToOpen }, "notepad.exe")

            • 3. Re: Now possible to scroll line-wrapped output in window of ModalDialog?
              areohbee Level 5

              Well, that's one way to get around the scroll problem.

               

              Consider opening in default app instead - in case user has preferred text editor, e.g. -

               

              Mac: LrShell.openFilesInApp( { file }, "open") -- macs like to feed the file to the "open" command.

              Win: LrShell.openFilesInApp( { "" }, file) -- open file like an app, windows knows what to do.

               

              R

              • 4. Re: Now possible to scroll line-wrapped output in window of ModalDialog?
                johnrellis Most Valuable Participant

                Jeffrey Friedl did it but I have no idea how.

                I think he did it the way other plugs do it -- a pre-allocated set of rows of controls whose contents get dynamically changed.

                 

                But he went beyond other plugins and provided a nice graphical scrollbar.  If you look in the i/ subdirectory of his plugin, you'll see a bunch of PNGs, some of which represent pieces of the scrollbar.  I'm guessing he created a column of dozens of picture controls, and dynamically changes them as the user clicks.  But just a guess.

                • 5. Re: Now possible to scroll line-wrapped output in window of ModalDialog?
                  areohbee Level 5

                  John R. Ellis wrote:

                   

                  ...as the user clicks...

                  Easy enough (albeit not that easy) to implement click scrolling, but Jeffrey Friedl's scrollbars can be dragged - *that's* the part I can't imagine how he did, since I didn't think SDK provided any sort of mouse info. Maybe he uses external app for support? Or knows how to get "ag" mouse info via lua, without SDK support?