https://forum.world.st/Phobos-Using-open-and-save-dialogs-tp4774528p4774578.html
I will look at it and add the methods to the Phobos code. You have to
server can be on a different computer. Then Pharo will not have direct
access to the file provided by XULRunner client.
> It's Ok I think I've got it.
>
> You can add a method like this to your main.js:
>
> function doFileOpen() {
> /* See:
>
http://developer.mozilla.org/en/docs/XUL_Tutorial:Open_and_Save_Dialogs */
>
> var nsIFilePicker = Components.interfaces.nsIFilePicker;
> var fp =
> Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
>
> fp.init(window, "Open File", nsIFilePicker.modeOpen);
> fp.appendFilters(nsIFilePicker.filterText | nsIFilePicker.filterAll);
>
> var res = fp.show();
> if (res == nsIFilePicker.returnOK) {
> var thefile = fp.file;
> return(thefile.leafName);
> // --- do something with the file here ---
> }
> }
>
> Then call it from pharo with an evaluateJS method - if you return the
> filename from the javascript method pharo can pick it up:
>
> MyPhobosComponent>>getFilename
> |res|
>
> res:= self evaluateJS:'doFileOpen();'.
>
> Of course, you could build the entire javascript method as a string in pharo
> and call it using evaluteJS but it's simpler to put it into main.js as
> deaing with embedded quotes is fiddly.
>
>
>
> --
> View this message in context:
http://forum.world.st/Phobos-Using-open-and-save-dialogs-tp4774528p4774537.html> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>