mirror of
https://gitee.com/energye/energy.git
synced 2024-11-30 18:57:39 +08:00
demo tray ipc message box
This commit is contained in:
parent
7e613898b6
commit
9bbe6057ca
@ -7,26 +7,36 @@
|
||||
a, button {
|
||||
margin: 15px;
|
||||
}
|
||||
body{
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
height: 400px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function trayShowMessageBox() {
|
||||
ipc.emit("tray-show-message-box");
|
||||
}
|
||||
|
||||
function trayShowBalloon() {
|
||||
ipc.emit("tray-show-balloon");
|
||||
}
|
||||
|
||||
function trayShowMainWindow() {
|
||||
ipc.emit("tray-show-main-window");
|
||||
}
|
||||
|
||||
function trayCloseMainWindow() {
|
||||
ipc.emit("tray-close-main-window");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body id="bodyId" style="border: 0; padding: 0;margin:0;overflow-x: hidden;overflow-y: hidden;">
|
||||
<button onclick="trayShowBalloon()">显示托盘汽泡</button><br>
|
||||
<button onclick="trayShowMainWindow()">显示窗口</button><br>
|
||||
<button onclick="trayShowBalloon()">显示托盘汽泡</button>
|
||||
<br>
|
||||
<button onclick="trayShowMainWindow()">显示窗口</button>
|
||||
<br>
|
||||
<button onclick="trayCloseMainWindow()">退出</button>
|
||||
<button onclick="trayShowMessageBox()">显示消息弹窗</button>
|
||||
</body>
|
||||
</html>
|
@ -391,7 +391,7 @@ func AppBrowserInit() {
|
||||
|
||||
// 托盘 只适用 windows 的系统托盘, 基于html 和 ipc 实现功能
|
||||
func cefTray(browserWindow *cef.TCefWindowInfo) {
|
||||
var url = "E:\\SWT\\gopath\\src\\swt-lazarus\\demo17-dll-load\\demo-golang-dll-01-chromium\\demos\\min-browser\\resources\\min-browser-tray.html"
|
||||
var url = "E:\\SWT\\gopath\\src\\github.com\\energye\\energy\\example\\mini-browser\\resources\\min-browser-tray.html"
|
||||
if !tools.IsExist(url) {
|
||||
url = consts.ExePath + consts.Separator + "min-browser-tray.html"
|
||||
}
|
||||
@ -422,6 +422,12 @@ func cefTray(browserWindow *cef.TCefWindowInfo) {
|
||||
ipc.IPC.Browser().On("tray-close-main-window", func(context ipc.IIPCContext) {
|
||||
browserWindow.Window.Close()
|
||||
})
|
||||
ipc.IPC.Browser().On("tray-show-message-box", func(context ipc.IIPCContext) {
|
||||
cef.QueueAsyncCall(func(id int) {
|
||||
lcl.ShowMessage("tray-show-message-box 提示消息")
|
||||
})
|
||||
tray.Hide()
|
||||
})
|
||||
//托盘 end
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user