3 Replies Latest reply on Feb 23, 2011 4:24 AM by DawMatt

    Is there a dialog to choose a folder?

    DFBurns Level 1

      If I use the standard Export dialog, the Export Location section has a button labeled 'Choose...' for custom folder locations. If I choose that, I get (at least on Windows) the standard directory-chooser dialog (i.e. not meant for choosing files, just directories). I'd like to invoke this in my own export plug-in but I don't see it in the LrDialogs namespace. Is there some other way I've missed? How do people handle the case where they don't want the user to choose a file, just a directory?

        • 1. Re: Is there a dialog to choose a folder?
          areohbee Level 5

          Wouldnt this do it? -

           

          LrDialogs.runOpenPanel( args ) Invokes the platform Open File dialog.

          First supported in version 1.3 of the Lightroom SDK.

           

          Parameters

          1. args
          (table) A table with these fields:
          • title: (string) The title of the dialog.
          • prompt: (string) The label of the default button. Replaces "Open".
          • canChooseFiles: (Boolean) True to allow files to be selected.
          • canChooseDirectories: (Boolean) True to allow directories to be selected.
          • canCreateDirectories: (Boolean) True to include a button to create directories.
          • allowsMultipleSelection: (Boolean) True to allow multiple files to be selected.
          • fileTypes: (string or table) The file types that can be selected.
          • accessoryView: (LrView) A custom view to be included in the dialog.
          • initialDirectory: (string, optional) Path to directory that should be initially opened.

           

           

          Set canChooseFiles to false, and canChooseDirectories to true...(?)

           

           

          • 2. Re: Is there a dialog to choose a folder?
            DFBurns Level 1

            Ah, you are correct. I was not expecting one parameter to completely change which standard dialog was used. I'm used to platform-independent SDK APIs having a 1:1 correspondence with the platform-specific APIs that they wrap. Changing canChooseFiles from false to true or vice versa completely changes it.

             

            Cheers,

            db

            • 3. Re: Is there a dialog to choose a folder?
              DawMatt Level 3

              Hi,

               

              Thanks for pointing out the function Rob.

               

              Its also worth noting that the last parameter (initialDirectory) works in Lightroom 2 even though it was first officially documented in Lightroom 3.  Just mentioning it in case people are interested in writing backwards compatible plugins.

               

              Matt