From 378d4b51e3112a3a27eabfd3aa97caec2bd5dafd Mon Sep 17 00:00:00 2001
From: LiFan <2308045698@qq.com>
Date: 星期五, 05 七月 2024 17:17:50 +0800
Subject: [PATCH] update

---
 jrj/project/vindexform.cpp |  108 ++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 81 insertions(+), 27 deletions(-)

diff --git a/jrj/project/vindexform.cpp b/jrj/project/vindexform.cpp
index 1d2dbfd..8d41e92 100644
--- a/jrj/project/vindexform.cpp
+++ b/jrj/project/vindexform.cpp
@@ -9,6 +9,8 @@
 #include "wobject/xaserver.hpp"
 #include "xcontrol/xcombobox.hpp"
 #include "xcontrol/xlayersheet.hpp"
+ #include "vbusiness/vframe/frame.vframe.vbusiness.hpp"
+
 
 using xml = KXMLDOMDocument;
 class __declspec(dllexport) vindexform: public xwin
@@ -34,7 +36,7 @@
 	int menuShow;
 
 	HWND m_npHwnd2; //openwindow
-	int m_startwin;
+	HWND m_startwin;
 
 public:
 	vindexform(void* implPtr,HWND hWnd):xwin(implPtr,hWnd){}
@@ -97,7 +99,58 @@
 		alert(L"clicked");
 		return 1;
 	}
+
 	int OnMenu(HWND hMenu)
+	{
+		if (!hMenu)
+		{
+			HWND hw = m_hMenu;
+			bool f = IsWindow(hw);
+
+			if (hw == 0 && f <= 0)
+			{
+				xaserverarg* arg = new xaserverarg();
+				HWND hWnd = GetHWND();
+				arg->SetParam(L"hwnd", (LPARAM)hWnd);
+				arg->SetParam(L"memuId", (LPARAM)cbx_menu.getNativePointer());
+				arg->SetParam(L"tabNo", (LPARAM)cbx_tab.getNativePointer());
+				arg->SetParam(L"panelNo", (LPARAM)cbx_panelNo.getNativePointer());
+				arg->SetParam(L"panelName", (LPARAM)cbx_panelName.getNativePointer());
+				xwin* pwin = OpenWindow(L"dev:xpage[vindexmenu.vx]", (LPARAM)arg);
+				m_hMenu = pwin->GetHWND();
+				hw = m_hMenu;
+				//return 1;
+			}
+			HWND HWND_TOPMOST = (HWND)-1;
+			HWND HWND_NOTOPMOST = (HWND)-2;
+			int SWP_NOSIZE = 0x0001;
+			int SWP_NOMOVE = 0x0002;
+			int SWP_SHOWWINDOW = 0x0040;
+			SetWindowPos(hw, HWND_TOPMOST, -1000, -1000, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
+		}
+		else
+		{
+			m_hMenu = hMenu;
+		}
+
+		xrect xr;
+		xcontrol xc = GetControl(L"xmMenu");
+		GetWindowRect(xc.GetHWND(), xr);
+		int l = xr.left;
+		int b = xr.bottom;
+
+		xrect r;
+		xc = GetControl(L"split");
+		GetWindowRect(xc.GetHWND(), r);
+		int t2 = r.top;
+		int b2 = r.bottom;
+
+		MoveWindow(m_hMenu, l - 7, b, 220, b2 - t2, true);
+
+		return 1;
+	}
+
+	int OnMenu1(xstring hMenu)
 	{
 		if (!hMenu)
 		{
@@ -127,7 +180,7 @@
 		}
 		else
 		{
-			m_hMenu = hMenu;
+			m_hMenu = (HWND)hMenu.toInt64();
 		}
 
 		xrect xr;
@@ -239,7 +292,7 @@
 		while (hItem > 1)
 		{
 			//mainsheet.DeleteSheet(hItem - 1);
-			SendMessage(GetHWND(), 0x401, L"xmSheetClose", 0);
+			SendMessage(GetHWND(), 0x401, (WPARAM)L"xmSheetClose", 0);
 			hItem = mainsheet.GetSheetCount();
 		}
 
@@ -265,7 +318,7 @@
 		if (m_Assignment == L"")
 			alert(L"鑾峰彇鐢ㄦ埛鏁版嵁澶辫触锛岃閲嶆柊鐧诲綍!");
 		else
-			xaserver::SetUID(m_Assignment);
+			xaserver::SetUID((LPWSTR)m_Assignment);
 
 		xcombobox::AddItem(memuId.GetHWND(), L"寮�濮�");
 		xcombobox::AddItem(tabNo.GetHWND(), L"-1");
@@ -304,7 +357,7 @@
 		xstring sInfo = m_Assignment;
 		if (s > 0)
 		{
-			HMENU m = xwin::CreatePopupMenu();
+			HMENU m = CreatePopupMenu();
 			int MF_STRING = 0x00000000;
 			int MF_DISABLED = 0x00000002;
 			int TPM_RIGHTBUTTON = 0x0002;
@@ -316,14 +369,14 @@
 				xstring id = xitem.selectSingleNode(L"AssignmentID").text();
 				xstring name = xitem.selectSingleNode(L"PositionName").text();
 				if (sInfo == id)
-					xwin::AppendMenu(m, MF_STRING | MF_CHECKED, i + 1, name);
+					AppendMenu(m, MF_STRING | MF_CHECKED, i + 1, name);
 				else
-					xwin::AppendMenu(m, MF_STRING, i + 1, name);
+					AppendMenu(m, MF_STRING, i + 1, name);
 			}
-			xrect xr;
+			RECT xr;
 			xpoint pt;
 			GetCursorPos(pt);
-			int res = TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), xr);
+			int res = TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), &xr);
 			if (res == 0) return 0;
 			KXMLDOMElement ele = li.item(res - 1);
 			xstring sInfoEx = ele.selectSingleNode(L"AssignmentID").text();
@@ -340,7 +393,7 @@
 
 	int OnAllCaption()
 	{
-		int m = xwin::CreatePopupMenu();
+		HMENU m = CreatePopupMenu();
 		int MF_STRING = 0x00000000;
 		int MF_DISABLED = 0x00000002;
 		int TPM_RIGHTBUTTON = 0x0002;
@@ -355,14 +408,14 @@
 			//string str = xcombobox::GetLBText(memuId.GetId(), i);
 			xstring str = mainsheet.GetSheetText(i);
 			if (i == k)
-				xwin::AppendMenu(m, MF_STRING | MF_CHECKED, i + 1, str);
+				AppendMenu(m, MF_STRING | MF_CHECKED, i + 1, str);
 			else
-				xwin::AppendMenu(m, MF_STRING, i + 1, str);
+				AppendMenu(m, MF_STRING, i + 1, str);
 		}
-		xrect xr;
+		RECT xr;
 		xpoint pt;
 		GetCursorPos(pt);
-		int res = xwin::TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), xr);
+		int res = TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), &xr);
 		if (res == 0) return 0;
 		int nSheet = mainsheet.GetSheetIndex();
 		if (nSheet == (res - 1)) return 0;
@@ -398,6 +451,8 @@
 		}
 		return 1;
 	}
+
+#if 0
 	int OnOpen(xstring pa)
 	{
 		//xwin::SendMessage(m_npHwnd2, 0x401, pa, 0);
@@ -408,22 +463,21 @@
 			return 1;
 		}*/
 
-		int p = pa.toInt();
 		xaserverarg arg ;
-		
 		xstring isnew = arg.GetArgString(L"_isNewModule");
 		xstring vx = arg.GetArgString(L"_ModuelPage");
 		if (isnew == L"Y")
 		{
 			if (vx.find(L".vx", 0) > 0 || vx.find(L".xpage", 0) > 0)
-				OpenWindow(L"dev:xpage[" + vx + L"]", p);
+				OpenWindow(L"dev:xpage[" + vx + L"]", arg);
 			else
 				openUrl(vx, p);
 			return 1;
 		}
-		OpenWindow(L"dev:xpage[vindexforold.vx]", p);
+		//OpenWindow(L"dev:xpage[vindexforold.vx]", p);
 		return 1;
 	}
+
 	int OnOpenForOld(xstring pa)
 	{
 		m_npHwnd2 = pa.toInt();
@@ -443,7 +497,7 @@
 		ShowWindow(m_npHwnd2, SW_MAXIMIZE);
 		return 1;
 	}
-
+#endif
 	int OnHelp()
 	{
 		OpenWindow(L"dev:xpage[trade.help3.vx]");
@@ -457,16 +511,16 @@
 
 		if (comdid ==L"xmAssignment") OnChangeLogin();
 		else if (comdid == L"xmAllCaption") OnAllCaption();
-		else if (comdid == L"xmMenu") OnMenu(L"");
+		else if (comdid == L"xmMenu") OnMenu(0);
 		else if (comdid == L"xmHelp") return OnHelp();
-		else if (comdid.find(L"menuid:", 0) >= 0) OnMenu(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
+		//else if (comdid.find(L"menuid:", 0) >= 0) OnMenu(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
 		else if (comdid.find(L"menuAgent:", 0) >= 0) OnMenuAgent(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
 		else if (comdid.find(L"changesheet:", 0) >= 0) OnChangeSheet(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
-		else if (comdid.find(L"openforoldid:", 0) >= 0) OnOpenForOld(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
-		else if (comdid.find(L"open:", 0) >= 0) OnOpen(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
+		//else if (comdid.find(L"openforoldid:", 0) >= 0) OnOpenForOld(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
+		//else if (comdid.find(L"open:", 0) >= 0) OnOpen(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
 		else if (comdid == L"xmRefreshTask")
 		{
-			SendMessage(m_startwin, 0x401, comdid, 0);
+			SendMessage(m_startwin, 0x401, (WPARAM)comdid.c_str(), 0);
 			return 1;
 		}
 
@@ -481,7 +535,7 @@
 	int OnAttachListon()
 	{
 		AttachEvent(L"WM_XCOMMAND",(FEvent)&vindexform::OnXCommand,this);
-		//AttachEvent(L"mdilayer", L"LYSN_SELECTEDSHEET",OnSheetChanged);	
+		//AttachEvent(L"mdilayer", L"LYSN_SELECTEDSHEET", (FEvent)&vindexform::OnSheetChanged);
 		////AttachEvent(L"mdilayer", L"LYSN_CLOSESHEET",OnCloseSheet);	
 		return 1;
 	}
@@ -518,8 +572,8 @@
 
 		if (cursheet != mainsheet.GetSheetIndex())
 		{
-			int hPicture = xwin::FindWindowEx(0, 0, L"XFrameWndClass", L"__ProductPicture");
-			if (hPicture > 0)
+			HWND hPicture = FindWindowEx(0, 0, L"XFrameWndClass", L"__ProductPicture");
+			if (hPicture)
 			{
 				int WM_CLOSE = 0x0010;
 				PostMessage(hPicture, WM_CLOSE, 0, 0);

--
Gitblit v1.9.3