From 9b3b2eb20b09e13da837a28f16e552ba70a090c4 Mon Sep 17 00:00:00 2001 From: LiFan <2308045698@qq.com> Date: 星期四, 24 四月 2025 14:48:21 +0800 Subject: [PATCH] update --- jrj/project/vindexmenu.cpp | 78 +++++++++++++++++++------------------- 1 files changed, 39 insertions(+), 39 deletions(-) diff --git a/jrj/project/vindexmenu.cpp b/jrj/project/vindexmenu.cpp index 6e711c9..dc15d4c 100644 --- a/jrj/project/vindexmenu.cpp +++ b/jrj/project/vindexmenu.cpp @@ -29,14 +29,13 @@ int tabNo; //int m_panelNo; // 褰撳墠鑿滃崟缁� - string m_Assignment; + xstring m_Assignment; public: vindexmenu(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} public: static vindexmenu* CreateInstance(void* implPtr, void* hWnd) { - vindexmenu* pWin = new vindexmenu(implPtr, (HWND)hWnd); - return pWin; + return new vindexmenu(implPtr, (HWND)hWnd); } int OnHideWin() @@ -51,13 +50,13 @@ return 1; } - int OnActive(TEvent* evt,int p) + int OnActive(TEvent* evt, LPARAM p) { int WA_INACTIVE = 0; int WA_ACTIVE = 1; int WA_CLICKACTIVE = 2; int SW_HIDE=0x1; - WPARAM lw = evt->wParam & 0xffff; + WPARAM lw = evt->wParam; int x = m_bCanDestroy; if( lw ==WA_INACTIVE && x==1 ) { @@ -78,7 +77,7 @@ arg.AddArg(L"Assignment", m_Assignment); if(xaserver::ExecXQuery(GetServerUrl(),L"[Menu.index.xq]",arg.GetString(),x)!=1) { - //trace(x.xml()); + alert(x.xml()); return -1; } Hxsoft::XFrame::KXMLDOMNodeList li=x.selectNodes(L"items/item"); @@ -87,9 +86,8 @@ for (i=0;i<s;i++) { KXMLDOMElement xitem= li.item(i); - void * p = new KXMLDOMElement(xitem); int k = cbx_panelName.AddItem(xstring(i).c_str()); - cbx_panelName.SetItemData(k, (LPARAM)p); + cbx_panelName.SetItemData(k, xitem); } return 1; } @@ -99,7 +97,7 @@ return cbx_panelName.GetCurSel(); } - int createTree(string id, HTREEITEM parentItem) + int createTree(xstring id, HTREEITEM parentItem) { if(tv_menu.GetChildItem(parentItem)) return 0; KXMLDOMDocument x; @@ -121,11 +119,11 @@ xitem= li.item(s - i - 1); string xid = xitem.selectSingleNode(L"id").text(); string Name=xitem.selectSingleNode(L"name").text(); - string image = L"15"; + xstring image = L"15"; if(xitem.selectSingleNode(L"image")) image=xitem.selectSingleNode(L"image").text(); HTREEITEM hBeforItem = 0; - HTREEITEM curItem=tv_menu.InsertItem(parentItem,hBeforItem,Name,(LPARAM)xid,xstring(image).toInt()); - string child=xitem.selectSingleNode(L"@child").text();//item.getAttribute("HasChild"); + HTREEITEM curItem=tv_menu.InsertItem(parentItem,hBeforItem,Name,(LPARAM)xid, xstring(image).toInt()); + xstring child=xitem.selectSingleNode(L"@child").text();//item.getAttribute("HasChild"); if ((xstring)child != L"0") tv_menu.SetItemChild1(curItem,1); } @@ -181,17 +179,17 @@ return 1; } - bool rClick(string str) + bool rClick(xstring str) { HMENU m = CreatePopupMenu(); int MF_STRING = 0x00000000; int TPM_RIGHTBUTTON = 0x0002; int TPM_RETURNCMD = 0x0100; AppendMenuW(m,MF_STRING, 1, str); - xrect xr = { 0,0,0,0 }; + RECT xr = { 0,0,0,0 }; xpoint pt; GetCursorPos(pt); - return TrackPopupMenu (m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, this->GetHandle(), xr); + return TrackPopupMenu (m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, this->GetHandle(), &xr); } int OnRClicked(TEvent* evt,int p) @@ -204,7 +202,7 @@ int ret = rClick(L"鏀惰棌鑿滃崟"); if(ret == 1) { - string id = (string)tv_menu.GetItemData(hItem); + xstring id = (xstring)tv_menu.GetItemData(hItem); KXMLDOMDocument x; xaserverarg arg; arg.AddArg(L"id",id); @@ -223,8 +221,8 @@ int dbClick(xtreeview& tid, HTREEITEM hItem) { HCURSOR hCursor = xutil::SetCursorWait(); - string id = (string)tid.GetItemData(hItem); - string label = tid.GetItemLabel(hItem); + xstring id = (string)tid.GetItemData(hItem); + xstring label = tid.GetItemLabel(hItem); KXMLDOMDocument x; xaserverarg* arg = new xaserverarg(); arg->AddArg(L"id",id); @@ -238,9 +236,9 @@ //alert(x.xml); int nIndex =cbx_menu.FindString(label); - if(e.selectSingleNode(L"ModuelMore") && nIndex > - 1) + /*if (e.selectSingleNode(L"ModuelMore") && nIndex > -1) { - string mo = e.selectSingleNode(L"ModuelMore").text(); + xstring mo = e.selectSingleNode(L"ModuelMore").text(); if((xstring)mo != L"Y") { xstring comd = L"changesheet:"+xstring(nIndex); @@ -248,7 +246,7 @@ OnHideWin(); return 0; } - } + }*/ if(e.selectSingleNode(L"ModuelPage")) {} else return -1; @@ -269,8 +267,8 @@ for (i=0;i<s;i++) { xitem= li.item(i); - string name = xitem.selectSingleNode(L"@name").text(); - string value=xitem.selectSingleNode(L"@value").text(); + xstring name = xitem.selectSingleNode(L"@name").text(); + xstring value=xitem.selectSingleNode(L"@value").text(); arg->AddArg(name, value); } } @@ -298,7 +296,7 @@ int no = GetCurPanel(); xnode anode(GetAgentNode(L"mainmemu")); int p =0; - string id=nullptr; + xstring id; int h = cbx_panelNo.FindString(xstring(no).c_str()); if(h < 0) { @@ -309,9 +307,9 @@ { LPARAM pa = cbx_panelName.GetItemData(i); if (!pa)return 1; - KXMLDOMElement& hData = *(KXMLDOMElement*)pa; - string Name= hData.selectSingleNode(L"name").text(); - string Image = L"15"; + KXMLDOMElement hData = pa; + xstring Name= hData.selectSingleNode(L"name").text(); + xstring Image = L"15"; if(hData.selectSingleNode(L"image")) Image=hData.selectSingleNode(L"image").text(); xstring str = (xstring)L"<xtoolbutton image='"+Image+L"' caption='"+Name+L"' height='24' name='xmPanel:"+xstring(i).c_str() + L"' style='background-color:none #ceecce none #ffffff;text-align:left'/>"; if(i == no) @@ -320,9 +318,9 @@ str += (xstring)L"<vbox><xtree imagelist='0' name='panelTree"+xstring(no)+ L"'/></vbox>"; //AttachEvent("panelTree"+no.toString(),"TVN_SELCHANGED",OnTreeSelChanged); xstring panelTree = L"panelTree"+xstring(no); - AttachEvent(nstring::clone(panelTree.c_str()),L"TVN_ITEMEXPANDING", (FEvent)&vindexmenu::OnTreeExpanding); - AttachEvent(nstring::clone(panelTree.c_str()),L"TVN_RCLICK", (FEvent)&vindexmenu::OnRClicked); - AttachEvent(nstring::clone(panelTree.c_str()),L"NM_DBLCLK", (FEvent)&vindexmenu::OnDbClick); + AttachEvent(panelTree.c_str(true),L"TVN_ITEMEXPANDING", (FEvent)&vindexmenu::OnTreeExpanding); + AttachEvent(panelTree.c_str(true),L"TVN_RCLICK", (FEvent)&vindexmenu::OnRClicked); + AttachEvent(panelTree.c_str(true),L"NM_DBLCLK", (FEvent)&vindexmenu::OnDbClick); } toolStr += str; } @@ -371,8 +369,8 @@ int OnMenuAgent() { - string s = L"menuAgent:Y"; - SendMessage(m_nHwnd, 0x401, (LPARAM)s, 0); + xstring s = L"menuAgent:Y"; + SendMessage(m_nHwnd, 0x401, (LPARAM)s.c_str(), 0); OnHideWin(); return 1; } @@ -430,7 +428,7 @@ int ret = rClick(L"鍙栨秷鏀惰棌"); if(ret == 1) { - string id = (string)tv_menu1.GetItemData(hItem); + xstring id = (xstring)tv_menu1.GetItemData(hItem); KXMLDOMDocument x; xaserverarg arg; arg.AddArg(L"id",id); @@ -458,14 +456,14 @@ int OnInitial() { - if(GetParam()) + if(GetWinParam()) { - xaserverarg& arg = *(xaserverarg*)GetParam(); + xaserverarg arg = GetArg(); m_nHwnd = (HWND)arg.GetParam(L"hwnd"); - cbx_menu = (void*)arg.GetParam(L"memuId"); - cbx_tab = (void*)arg.GetParam(L"tabNo"); - cbx_panelNo = (void*)arg.GetParam(L"panelNo"); - cbx_panelName = (void*)arg.GetParam(L"panelName"); + cbx_menu = (void*)arg.GetParam(L"cbx_menu"); + cbx_tab = (void*)arg.GetParam(L"cbx_tab"); + cbx_panelNo = (void*)arg.GetParam(L"cbx_panelNo"); + cbx_panelName = (void*)arg.GetParam(L"cbx_panelName"); xstring s = L"menuid:"+xstring((LPARAM)GetHWND()); SendMessage(m_nHwnd, 0x401, (LPARAM)s.c_str(), 0); } @@ -475,6 +473,8 @@ int onload() { + SetArg(); + m_bCanDestroy = 1; tv_menu1 = GetControl(L"menu1"); -- Gitblit v1.9.3