nw.js icon indicating copy to clipboard operation
nw.js copied to clipboard

File dialogs cancel/abort events?

Open b1rdex opened this issue 11 years ago • 7 comments

As all we know, there is no API for selecting files/folders, there is <input type="file">' and waiting forchange` event of it.

But there is big problem: this way we have no callback with common parameters error and filepath. In my app user MUST choose file. But user can click × on dialog. Or simply click cancel. But app can't get event that dialog was closed without selecting filepath.

I think we finally have to get API for selecting files/folders.

So points to implement this:

  • there is a lot of options currently and I have another to include — a way to rename dialog buttons and dialog title
  • it's better to have single service you ask for filepath rather then lot of DOM nodes waiting for change
  • as service it'll be usable from node.js context

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

b1rdex avatar Jun 19 '15 04:06 b1rdex

Thanks for reporting. Would like to support this.

rogerwang avatar Jun 22 '15 13:06 rogerwang

@rogerwang found same API in electron — https://github.com/atom/electron/blob/master/docs/api/dialog.md

b1rdex avatar Jun 22 '15 13:06 b1rdex

+1

Yimiprod avatar Jul 02 '15 12:07 Yimiprod

+1

taotao365s avatar Jul 03 '15 13:07 taotao365s

See (https://github.com/nwjs/nw.js/issues/4501#issuecomment-208723806) for a possible workaround to catch the cancel event, at least in nw.js 0.12.3 (not tested with 0.13)

TrevorPT avatar Apr 12 '16 06:04 TrevorPT

See #4501

b1rdex avatar Apr 12 '16 06:04 b1rdex

This is fixed in git and will be available in the next nightly build. Additional "oncancel" event listener is now supported for this.

rogerwang avatar Apr 20 '16 05:04 rogerwang