Lightroom SDK: runOpenPanel - unable to select both folders and files

  • 1
  • Problem
  • Updated 5 years ago
LrDialogs.runOpenPanel has arguments:

canChooseFiles (boolean)
canChooseDirectories (boolean)

Here's how it works for me:

both false : file chooser (not unreasonable - included for sake of completeness)
canChooseFiles true; canChooseDirectories false : file chooser (check)
canChooseFiles false; canChooseDirectories true: folder chooser (check)
both true : folder chooser (*this* is the problem).

As you can see, the setting for canChooseFiles is ineffective. i.e. whether folder-chooser or file-chooser is governed only by setting of canChooseDirectories.

R
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 372 Reply Likes

Posted 5 years ago

  • 1
Photo of John R. Ellis

John R. Ellis, Champion

  • 3386 Posts
  • 854 Reply Likes
Hmm, the Any File plugin uses both canChooseFiles and canChooseDirectories.


local paths = LrDialogs.runOpenPanel {
title = "Files and Folders to Import", canChooseFiles = true,
canChooseDirectories = true, canCreateDirectories = false,
allowsMultipleSelection = true,
intialDirectory = LrPathUtils.getStandardFilePath ("pictures"),
fileTypes = fileTypes,
accessoryView =
WIN_ENV and f:column {
f:spacer {height = 5},
f:static_text {title = "Click Choose Selected to select one " ..
"or more folders"},
f:static_text {title = ""}}
or nil}
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 372 Reply Likes
OK, I've been able to select folders, or files, but not both simultaneously - I guess that's the limitation.

PS - Does fileTypes table work? I can make fileTypes string work, but no matter what table I pass, it just says "Supported Types", and there is no filtering, and any file-type can be selected.
Photo of John R. Ellis

John R. Ellis, Champion

  • 3386 Posts
  • 854 Reply Likes
That's what happens with Any File too -- passing a table has no effect.
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 372 Reply Likes
Thanks John.

Out of curiosity, what's the empty static text item for in the accessory view? (doesn't do anything that I can tell - a leftover/placeholder?).
Photo of John R. Ellis

John R. Ellis, Champion

  • 3386 Posts
  • 854 Reply Likes
In LR 3 at least, the "Click Choose Selected" label was too close to the bottom of the dialog, so the static text added a blank line. Don't know if that's still an issue with LR 4.
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 372 Reply Likes
Ah - does not seem to be an issue in Lr4.
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 372 Reply Likes
Bottom-line: although I would like to be able to select both folders and files, *simultaneously*, the present implementation should probably not be considered a "problem". - call it a feature request...