Exemplo n.º 1
0
func onWndMenuSelect(nID int, pbHandled *bool) int {
	switch nID {
	case 1330:
		web.XWeb_LoadUrl(hWeb, "http://www.hupu.cn")
	case 1331:
		web.XWeb_Reload(hWeb)
	case 1332:
		web.XWeb_StopLoading(hWeb)
	case 1333:
		// web.XWeb_SetProxy(hWeb, proxyType, hostName, port, username, pwd)
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow), "代理", "请在源码中设置代理服务器.", xcgui.MB_ICONWARNING)
	case 1334:
		zom := web.XWeb_GetZoom(hWeb)
		zom += 0.3
		web.XWeb_Zoom(hWeb, zom)
	case 1335:
		zom := web.XWeb_GetZoom(hWeb)
		zom -= 0.3
		web.XWeb_Zoom(hWeb, zom)
	case 1336:
		web.XWeb_ZoomReset(hWeb)
	case 1337:
		pCookie := web.XWeb_GetCookie(hWeb)
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow),
			"Cookie", pCookie, xcgui.MB_ICONINFORMATION)
	case 1338:
		web.XWeb_LoadUrl(hWeb, "file://./jsCallFunction.html")
	case 1340:
		web.XWeb_SetEditable(hWeb, true)
	case 1341:
		web.XWeb_SetEditable(hWeb, false)
	case 1351:
		web.XWeb_RunJs(hWeb, "javascript: alert('JS: \n    炫彩界面库-golang.')")
	case 1352:
		if web.XWeb_IsDocumentReady(hWeb) {
			SetStat("网页加载完毕!")
		} else if web.XWeb_IsLoadingCompleted(hWeb) {
			SetStat("网页加载完成!")
		} else if web.XWeb_IsLoadingFailed(hWeb) {
			SetStat("网页加载失败!")
		}
	case 1353:
		fmt.Println("js模拟填写,还未完成.")
	case 1360:
		version := web.XWeb_GetVersionString()
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow), "版本", version, xcgui.MB_ICONINFORMATION)
	}

	return 0
}
Exemplo n.º 2
0
func MsgBox(owner Window, title, message string, style MsgBoxStyle) int {
	var ownerHWnd xc.HWND

	if owner != nil {
		ownerHWnd = owner.Handle()
	}

	return int(xc.MessageBox(
		ownerHWnd,
		title,
		message,
		uint32(style)))
}
Exemplo n.º 3
0
func OnWndMenuSelect(nID int, pBool bool) int {
	switch nID {
	case 1011:
		ni.ShowInfo("提示信息", "炫彩菜单101-1")
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow), "提示信息", "炫彩菜单101-1", xcgui.MB_ICONINFORMATION)
	case 1012:
		ni.ShowWarning("警告信息", "炫彩菜单101-2")
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow), "警告信息", "炫彩菜单101-2", xcgui.MB_ICONWARNING)
	case 102:
		ni.ShowError("错误信息", "炫彩菜单102")
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow), "错误信息", "炫彩菜单102", xcgui.MB_ICONERROR)
	case 106:
		ni.ShowMessage("退出程序", "正在退出程序...")
		ni.Dispose()
		walk.App().Exit(0)
		xcgui.XExitXCGUI()
	default:
		ni.ShowMessage("其他信息", "您选择的菜单:"+fmt.Sprint(nID))
		xcgui.MessageBox(xcgui.XWnd_GetHWND(hWindow), "其他信息", "您选择了其他菜单.", xcgui.MB_USERICON)
	}

	return 0
}