在所有其他窗口的顶部显示对话框 [英] Show dialog on top of all other windows

查看:14
本文介绍了在所有其他窗口的顶部显示对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在所有内容之上显示来自 dialog.showMessageBox() 的对话框?

Is there a way to show the dialog from dialog.showMessageBox() on top of everything?

例如,我在记事本上工作,并在我的 Electron 应用程序中给定一些事件,它将打开一个对话框,现在应该是用户查看的主窗口.

For example, I'm woking on the notepad and given some event in my Electron application it will open a dialog that should now be the main window for the user to see.

推荐答案

这有点难看,但你可以传递一个始终在顶部的虚拟持有者浏览器窗口.

It's kinda ugly but you can pass a dummy holder browserwindow which is always on top.

dialog.showMessageBox(
  new BrowserWindow({
    show: false,
    alwaysOnTop: true
  }),
  {
    type: 'question',
    message: 'is on top'
  }
)

这篇关于在所有其他窗口的顶部显示对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆