Option to specify dialog title

Started by Carlo Didier, November 28, 2017, 04:29:25 PM

Previous topic - Next topic

Carlo Didier

It would be nice to be able to specify a custom title for certain dialogs like the folderBrowser().
Instead of just "Select folder(s)", we could then display for example "Select folder to scan", "Select start folder", "Please select destination folder" or whatever as the title.

This could avoid confusion and errors if more than one such dialog is used in an app.

Mario

Is this a request for scripting or do you want to have preferences in IMatch to use custom captions for these dialogs?

If this is for scripting, please read the documentation again. Especially the title parameter.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Carlo Didier

I don't see a title parameter in the doc. See attachment.
I'd like to have an additional parameter to specify my own title, as shown in my previous screenshot.

Jingo

Not all the parameters are contained within the same "function" from the documentation... sometimes you find parameters for other items that work in other places.  This is why I always recommend looking at the fantastically documented imatchlib.js program - all the info you need is shown there:

/**
     * This function displays a standard Windows file system folder browser dialog.
     * @param {Object} params
     * @param {String} [params.title] The title/prompt to display in the dialog.
     * @param {String} [params.initialdir] The initial directory to select in the dialog. If this is not specified, Windows selects the initial folder.
     * @returns {Promise} On success returns a JSON object in the following format:
     * <pre>{
     *     "result" : "ok" or "cancelled"
     *     "folderName" : Fully-qualified folder name
     * }</pre>
     * @example
     * // Let the user select a folder.
     * IMatch.folderBrowserFS({
     *      title: 'Please select a folder:'
     * }).then(function(response) {
     *      console.log(JSON.stringify(result,null,2));
     * });
     */
    this.folderBrowserFS = function(params) {
        return self.get('v1/imatch/filesystem/folderbrowser',params);
    }

Mario

#4
Ah, FolderBrowserFS and folderBrowser are different things.
For selecting a database folder there is no custom title. Only for selecting a file system folder. The endpoint does not support a custom title because it is assumed that, since the user always selects a folder from the database, none is needed. Maybe adjust your UI so the user knows before for which purpose he is selecting a folder?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Carlo Didier

Thanks for the tip, Jingo.

I think the main documentation should list all available parameters.
I wouldn't have dreamed of looking into imatchlib.js which should be like a black box of which I don't have to know the inner workings.
And I won't delve into that each time just to check if anything is missing from the official doc ...

Carlo Didier

Quote from: Mario on November 28, 2017, 07:52:16 PMMaybe adjust your UI so the user knows before for which purpose he is selecting a folder?

Hmm, not easy in this case. I have two buttons, one to select a first folder and one to select a second folder.
Once any one of the buttons is pressed and the dialog open, there is no way to know which one it was if it isn't in the title of the dialog. That's why I wanted to customize it.

Mario

The Folder Browser dialog in IMatch has no custom prompt, hence the endpoint cannot support one.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook