0

I'm writing a Lua program that must prompt the user for a directory as one of a number of parameters for an operation (that involves copying a file to a target directory with a new name). Environment is Windows; I'm using Lua 5.1.

The relevant code currently looks like

require("iuplua")
local mediaFolder = "C:\some folder\some subfolder\"
local pPrompt = --this is a subset of the parameters
  "File name: %s\n"..
  "Destination: %f[DIR||"..mediaFolder.."]\n"

ret, strTargetFile, strTargetPath =
  iup.GetParam("Add Media from file ", param_action, pPrompt, "Initial file name", mediaFolder)

The resultant GUI looks like:

enter image description here

but when the selector button (...) is pressed, the initial directory shown is not C:\some folder\some subfolder\ but whatever directory was last navigated to in the interface, and it isn't possible to select a directory, only a file.

I'm guessing I have a fundamental misunderstanding of how this should work? Is what I want to do possible with iup? Ideally, I'd also like to restrict the user to only selecting the initial directory or one of its sub-directories rather than navigating anywhere outside that directory structure, and to allow the user to create a new sub-folder.

ColeValleyGirl
  • 577
  • 15
  • 40

1 Answers1

0

This looks like a bug. I'll check it.

Don't know if Stack Overflow is a place for bug reports, but I monitor iup posts here.

Best

Antonio Scuri
  • 1,046
  • 6
  • 10
  • Thanks -- I thought I was going crazy! – ColeValleyGirl Oct 12 '18 at 12:57
  • Hi, it is not a bug. All extra separators must be specified. When one is missing it uses the default which is the regular file selection. So in your sample change: "Destination: %f[DIR||"..mediaFolder.."]\n" For: "Destination: %f[DIR||"..mediaFolder.."||]\n" – Antonio Scuri Oct 17 '18 at 17:17
  • Thanks -- it's working now (still has all the defects of the Windows directory selection dialog, but that's not your fault). One more quick question if I might -- I can't work out from the documentation if it's possible to adjust the size of the GetParam dialog? -- whenever it's opened in my program, it has to be resized manually in width to see all of the default parameter values. No problem if not -- I'll experiment with ParamBox instead. – ColeValleyGirl Oct 18 '18 at 07:04
  • About the Windows directory selection dialog, in SVN we added a new IupFileDlg implementation using the Vista API that has a newer interface. Once initialized the new library will replace the old implementation, for all IupFileDlg instances. But it has the limitation of not having the preview support in the FILE_CB callback. – Antonio Scuri Oct 19 '18 at 13:06
  • To change the default size of the dialog use the FILE_CB callback, and manually change the dialog size to what you need when param_index=IUP_GETPARAM_INIT. For instance: IupSetAttribute(IupGetDialog(param_box), "RASTERSIZE", "800x"); – Antonio Scuri Oct 19 '18 at 13:13