Any established workarounds for NG Client?

Hi all,

is there any resource showing how to deal with the various issues you come across when converting from Smart Client to NG-Client? I’m thinking of
showCalendar
showFileOpenDialog
showFileSaveDialog
setClipBoardContent
and the others which generate warnings when you set a project to ‘NG-Client only’

Some of these are impossible to recreate in a browser, while others require thinking in a very different way.

Take the code to export a report as a text file: In the smart client you ask the user to specify a file to save the data in, you generate and save the data and maybe you open the resulting file.
On the web you would get the server to generate the file and send it to the browser as a download or to a new tab in your browser…
what is the quickest way to do that in Servoy?

Thanks,

I have found that NG-client does not like

var win = application.createWindow("address_popup", JSWindow.WINDOW, null);
controller.show(win);

The window does not show. Making the window MODAL fixes this.

var win = application.createWindow("address_popup", JSWindow.MODAL_DIALOG, null);
controller.show(win);

In my series of discoveries:
Showing the Open File dialog in Smart Client:

function import_something(event) {
     var file = plugins.file.showFileOpenDialog(1, null, false, new Array("txt", "txt"));
     //do your stuff
}

becomes

function import_something(event) {
    plugins.file.showFileOpenDialog(1, null, false, new Array("txt", "txt"),import_deliveries_callback);
}

/**
 *
 * @param {Array<plugins.file.JSFile>} files
 */
function import_deliveries_callback(files) {
     if (files.length) {
         var file = files[0];
         //do your stuff
     }
}

in NG-client.

setClipBoardContent equivalent in NG-Client:

Make a simple form with a text area and define a form variable to hold the text you’d want to put on the clipboard.

Use

application.createWindow("clipboard_popup", JSWindow.MODAL_DIALOG, null);

to display the window as a modal dialog. Ask the user to do the copy-and-paste. That is as close as you can get in a web browser.

Why would I use setClipBoardContent in the first place? You can create an email in the users default email client by using

application.showURL("mailto:" + to_email + "?subject=" + subject + "&body=" + some_message);

This will fail if the message gets too long (I stop at 1,600 character to be safe) so asking the user to copy-and-paste is a fallback.