photools.com Community

IMatch Bug Reports and Feature Requests => Feature Requests => Archive (Feature Requests) => Topic started by: Carlo Didier on November 28, 2017, 04:29:25 PM

Title: Option to specify dialog title
Post by: Carlo Didier on November 28, 2017, 04:29:25 PM
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.
Title: Re: Option to specify dialog title
Post by: Mario on November 28, 2017, 06:17:52 PM
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.
Title: Re: Option to specify dialog title
Post by: Carlo Didier on November 28, 2017, 07:25:29 PM
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.
Title: Re: Option to specify dialog title
Post by: Jingo on November 28, 2017, 07:42:44 PM
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);
    }
Title: Re: Option to specify dialog title
Post by: Mario on November 28, 2017, 07:52:16 PM
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?
Title: Re: Option to specify dialog title
Post by: Carlo Didier on November 28, 2017, 07:57:08 PM
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 ...
Title: Re: Option to specify dialog title
Post by: Carlo Didier on November 28, 2017, 07:59:17 PM
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.
Title: Re: Option to specify dialog title
Post by: Mario on November 28, 2017, 09:06:55 PM
The Folder Browser dialog in IMatch has no custom prompt, hence the endpoint cannot support one.