提交 8cd155e1 编写于 作者: yanghye's avatar yanghye

U: demo msgbox

上级 12338f77
...@@ -45,24 +45,22 @@ func main() { ...@@ -45,24 +45,22 @@ func main() {
// 系统消息提示框目前仅能在LCL窗口组件下使用 // 系统消息提示框目前仅能在LCL窗口组件下使用
// LCL 各种系统组件需要在UI线程中执行, 但ipc.on非UI线程 // LCL 各种系统组件需要在UI线程中执行, 但ipc.on非UI线程
// 所以需要使用 QueueAsyncCall 包裹在UI线程中执行 // 所以需要使用 QueueAsyncCall 包裹在UI线程中执行
if window.IsLCL() { ipc.On("showmsgbox", func() {
ipc.On("showmsgbox", func() { fmt.Println("showmsgbox")
cef.QueueAsyncCall(func(id int) { window.RunOnMainThread(func() {
lcl.ShowMessage("消息提示框") fmt.Println("消息提示框")
}) lcl.ShowMessage("消息提示框")
}) })
ipc.On("showmsgbox-confirm", func() { })
// lcl 各种系统组件需要在UI线程中执行, 但ipc.on非UI线程 ipc.On("showmsgbox-confirm", func() {
// 所以需要使用 QueueAsyncCall 包裹在UI线程中执行 // lcl 各种系统组件需要在UI线程中执行, 但ipc.on非UI线程
cef.QueueAsyncCall(func(id int) { // 所以需要使用 QueueAsyncCall 包裹在UI线程中执行
if lcl.Application.MessageBox("消息", "标题", win.MB_OKCANCEL+win.MB_ICONINFORMATION) == types.IdOK { window.RunOnMainThread(func() {
lcl.ShowMessage("你点击了“是") if lcl.Application.MessageBox("消息", "标题", win.MB_OKCANCEL+win.MB_ICONINFORMATION) == types.IdOK {
} lcl.ShowMessage("你点击了“是")
}) }
}) })
// 使用窗口模拟一个消息提示框 })
}
}) })
//运行应用 //运行应用
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册