New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for child windows #6140

Merged
merged 23 commits into from Jun 20, 2016

Conversation

Projects
None yet
1 participant
@zcbenz
Contributor

zcbenz commented Jun 20, 2016

WIP

This is still under testing, each platform has huge differences on how the child windows should work, I'm trying to figure out a way to make the API work consistently on all platforms without platform-dependent code.

Close #323.

Docs

Parent and child windows

By using parent option, you can create child windows:

let top = new BrowserWindow()
let child = new BrowserWindow({parent: top})

The child window will always show on top of the top window.

Modal windows

A modal window is a child window that disables parent window, to create a modal
window, you have to set both parent and modal options:

let child = new BrowserWindow({parent: top, modal: true, show: false})
child.loadURL('https://github.com')
child.once('ready-to-show', () => {
  child.show()
})

Platform notices

  • On macOS the child windows will keep the relative position to parent window
    when parent window moves, while on Windows and Linux child windows will not
    move.
  • On Windows it is not supported to change parent window dynamically.
  • On Linux the type of modal windows will be changed to dialog.
  • On Linux many desktop environments do not support hiding a modal window.

@zcbenz zcbenz merged commit 3428874 into master Jun 20, 2016

7 of 8 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
electron-linux-arm Build #3477575 succeeded in 39s
Details
electron-linux-ia32 Build #3477576 succeeded in 33s
Details
electron-linux-x64 Build #3477577 succeeded in 124s
Details
electron-mas-x64 Build #1611 succeeded in 6 min 43 sec
Details
electron-osx-x64 Build #1616 succeeded in 6 min 14 sec
Details
electron-win-ia32 Build #613 succeeded in 6 min 21 sec
Details
electron-win-x64 Build #607 succeeded in 6 min 29 sec
Details

@zcbenz zcbenz deleted the parent branch Jun 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment