From 1da53228302e85d8dd44e2ea82e66f8ee7470811 Mon Sep 17 00:00:00 2001
From: xj qian <qianxj15@sina.com>
Date: 星期一, 08 七月 2024 17:53:11 +0800
Subject: [PATCH] update xcombobox
---
jrj/project/total3/ViewTotalWin.cpp | 182 +++++++++++++++++++++++----------------------
jrj/xframe/xcontrol/xcombobox.hpp | 6 +
2 files changed, 98 insertions(+), 90 deletions(-)
diff --git a/jrj/project/total3/ViewTotalWin.cpp b/jrj/project/total3/ViewTotalWin.cpp
index d330173..f6feafe 100644
--- a/jrj/project/total3/ViewTotalWin.cpp
+++ b/jrj/project/total3/ViewTotalWin.cpp
@@ -4,6 +4,11 @@
#include <xcontrol/xcell.hpp>
#include <xcontrol/xflowchart.hpp>
#include <xcontrol/ximageview.hpp>
+#include <xcontrol/xcombobox.hpp>
+
+#include <vbusiness/vutil/publiccode.vutil.vbusiness.hpp>
+#include "viewobject/view.base.hpp""
+
using xml = KXMLDOMDocument;
class __declspec(dllexport) ViewTotalWin : public xwin
@@ -20,17 +25,17 @@
xcell dw_cell;
xnode m_agentNode; //Agent Condition
KXMLDOMElement rptEle;
- string m_category;
- string argStr;
- string searchStr;
- string fieldRoleStr;
- int hWndImageView;
- int hWndRetrieveTip;
+ xstring m_category;
+ xstring argStr;
+ xstring searchStr;
+ xstring fieldRoleStr;
+ HWND hWndImageView;
+ HWND hWndRetrieveTip;
bool dataretrieveing;
int SetAgent()
{
- string xfNodeAgentArea = L"agentarea";
+ xstring xfNodeAgentArea = L"agentarea";
xnode anode = GetAgentNode(xfNodeAgentArea);
if (m_agentNode)
{
@@ -42,7 +47,7 @@
KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*");
if (agent)
{
- string s = agent.xml();
+ xstring s = agent.xml();
m_agentNode = SetAgentNode(anode, s);
}
}
@@ -51,12 +56,12 @@
int OnSearch()
{
- xaserverarg arg = new xaserverarg;
- arg.setNativePointer(arg.CreateInstance());
+ xaserverarg arg ;
+
arg.AddArg(L"text", searchStr);
//trace(searchStr);
- OpenWindow(L"dev:xpage[search.dialog.vx]", cast(arg as int));
- string str = arg.GetArgString(L"text");
+ OpenWindow(L"dev:xpage[search.dialog.vx]", arg);
+ xstring str = arg.GetArgString(L"text");
if (str != searchStr)
{
searchStr = str;
@@ -67,7 +72,7 @@
}
//焦点激活处理函数
- int OnSetFocus(ref TEvent evt, int param)
+ int OnSetFocus(TEvent * evt, int param)
{
//重置工具条
SetAgent();
@@ -75,9 +80,9 @@
}
//命令发布函数
- int OnCmdDispatch(string comdid)
+ int OnCmdDispatch(xstring comdid)
{
- string UserNo = publiccode::GetUser().no;
+ xstring UserNo = publiccode::GetUser().no;
int hCursor = 0;
if (comdid == L"xmSearch") return OnSearch();
@@ -86,14 +91,13 @@
//{
if (comdid == L"xmAnalysis")
{
- hCursor = xutil::SetCursorWait();
- string str = dw_list.DataAnalysis(L"");
- xaserverarg arg = new xaserverarg;
- arg.setNativePointer(arg.CreateInstance());
+ HCURSOR hCursor = xutil::SetCursorWait();
+ xstring str = dw_list.DataAnalysis(L"");
+ xaserverarg arg ;
+
arg.AddArg(L"html", str);
- int obj = cast(dw_list as int);
- arg.AddArg(L"obj", obj.toString());
- OpenWindow(L"dev:xpage[data.vanalysis.vx]", cast(arg as int));
+ arg.SetParam(L"obj",(LPARAM)&dw_list);
+ OpenWindow(L"dev:xpage[data.vanalysis.vx]", arg);
xutil::RestoreCursor(hCursor);
return 1;
}
@@ -104,20 +108,19 @@
}
if (comdid == L"xmRemarks")
{
- string name = rptEle.getAttribute(L"name");
+ xstring name = rptEle.getAttribute(L"name");
xml x = ViewObject::RetrieveData(L"/sale/data/TradeFinance3/GetSetUpRemarks", L"Type", name);
- KXMLDOMNodeList items = x.GetXmlDoc().selectNodes(L"data/Item");
+ KXMLDOMNodeList items = x.selectNodes(L"data/Item");
KXMLDOMNode t = items.item(0);
- string Content = L"";
+ xstring Content = L"";
if (t.selectSingleNode(L"Content"))
{
- Content = t.selectSingleNode(L"Content").text;
+ Content = t.selectSingleNode(L"Content").text();
}
- xaserverarg arg1 = new xaserverarg;
- arg1.setNativePointer(arg1.CreateInstance());
+ xaserverarg arg1 ;
arg1.AddArg(L"value", Content);
- OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg1.getNativePointer());
+ OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg1);
return 1;
}
@@ -128,20 +131,20 @@
{
if (rptEle)
{
- string argUrl = rptEle.getAttribute(L"arg");
+ xstring argUrl = rptEle.getAttribute(L"arg");
if (argUrl != L"")
{
- xaserverarg ar = new xaserverarg;
+ xaserverarg ar ;
ar.setNativePointer(ar.CreateInstance());
ar.AddArg(L"argurl", argUrl);
if (argStr != L"")
ar.AddArg(L"arg", argStr);
- OpenWindow(L"dev:xpage[view.total.arg.vx]", cast(ar as int));
- string arstr = ar.GetArgString(L"arg");
+ OpenWindow(L"dev:xpage[view.total.arg.vx]", ar);
+ xstring arstr = ar.GetArgString(L"arg");
if (arstr != L"" && ar.GetArgString(L"action") == L"ok")
{
argStr = arstr;
- hCursor = xutil::SetCursorWait();
+ HCURSOR hCursor = xutil::SetCursorWait();
//trace(rptEle.getAttribute(L"data"));
OnRetrieve(rptEle.getAttribute(L"data"), argStr);
xutil::RestoreCursor(hCursor);
@@ -159,7 +162,7 @@
{
int row = dw_list.GetRow();
- string skuid = dw_list.GetGuid(row);
+ xstring skuid = dw_list.GetGuid(row);
OnLookImage(skuid);
return 1;
}
@@ -172,22 +175,22 @@
return 0;
}
- int OnLookImage(string skuid)
+ int OnLookImage(xstring skuid)
{
- int hCursor = xutil::SetCursorWait();
- xaserverarg arg = ViewObject::MakeArg();
+ HCURSOR hCursor = xutil::SetCursorWait();
+ xaserverarg arg;
arg.AddArg(L"guid", skuid);
- OpenWindow(L"dev:xpage[ViewPictures.vx]", arg.getNativePointer());
+ OpenWindow(L"dev:xpage[ViewPictures.vx]", arg);
xutil::RestoreCursor(hCursor);
return 1;
}
int AdjustField(xdwgrid dw)
{
- string str = fieldRoleStr;
+ xstring str = fieldRoleStr;
for (int i = 1; i < dw.GetColumnCount(); i++)
{
- string colname = dw.GetColumnName(i);
+ xstring colname = dw.GetColumnName(i);
if (str.find(L"!" + colname + L",L") >= 0)
{
dw.SetColumnState(colname, false);
@@ -198,9 +201,9 @@
int SwitchReport(KXMLDOMElement e)
{
- string dwname = e.getAttribute(L"template");
- string dataurl = e.getAttribute(L"data");
- string sheettype = e.getAttribute(L"reporttype");
+ xstring dwname = e.getAttribute(L"template");
+ xstring dataurl = e.getAttribute(L"data");
+ xstring sheettype = e.getAttribute(L"reporttype");
if (rptEle != e)
{
argStr = L"";
@@ -209,7 +212,7 @@
if (sheettype == L"") sheettype = L"report";
SwitchLayer(L"dw_" + sheettype, L"report");
if (sheettype == L"report")dw_list.openUrl(dwname);
- if (hWndImageView) win32::DestroyWindow(hWndImageView);
+ if (hWndImageView) DestroyWindow(hWndImageView);
AdjustField(dw_list);
@@ -217,15 +220,15 @@
return 1;
}
- int OnCombboChanged(ref TCommandEvent evt, int lParam)
+ int OnCombboChanged(TEvent* evt, int lParam)
{
- int h = xcombobox::GetCurSel(evt.hCtrl);
+ int h = xcombobox::GetCurSel(evt->command.hCtrl);
if (h > -1)
{
- int hCursor = xutil::SetCursorWait();
- KXMLDOMElement e = xcombobox::GetItemData(evt.hCtrl, h);
+ HCURSOR hCursor = xutil::SetCursorWait();
+ KXMLDOMElement e = xcombobox::GetItemData(evt->command.hCtrl, h);
SwitchReport(e);
- win32::PostMessage(GetHWND(), 0x401, L"xmQuery", 0);
+ PostMessage(GetHWND(), 0x401, L"xmQuery", 0);
//OnCmdDispatch(L"xmQuery");
xutil::RestoreCursor(hCursor);
}
@@ -234,13 +237,12 @@
int OnTransData()
{
- int ret = win32::MessageBox(GetHWND(), L"是否更新数据?\n更新过程预计需要四十分钟,如果中间弹出等待时间过长的提示,请点击中间重试按钮,或等待到一定时间再点击", L"提示", 0x4 /*yesno*/);
+ int ret = MessageBox(GetHWND(), L"是否更新数据?\n更新过程预计需要四十分钟,如果中间弹出等待时间过长的提示,请点击中间重试按钮,或等待到一定时间再点击", L"提示", 0x4 /*yesno*/);
if (ret != 6 /*IDYES */) return 1;
- xml x = new.xml();
- x.setNativePointer(xml::CreateInstance());
- int hCursor = xutil::SetCursorWait();
- if (url::get(L"/sale/data/Total3/total/transdata", L"", x) != 1)
+ xml x ;
+ HCURSOR hCursor = xutil::SetCursorWait();
+ if (xurl::get(L"/sale/data/Total3/total/transdata", L"", x) != 1)
{
xutil::RestoreCursor(hCursor);
return 1;
@@ -256,70 +258,70 @@
}
//命令处理事件
- int OnXCommand(ref TXCommandEvent evt, int param)
+ int OnXCommand(TEvent* evt, int param)
{
- return OnCmdDispatch(evt.pStrID);
+ return OnCmdDispatch(evt->command.pStrID);
}
int SendImageMessage(int row)
{
if (dw_list.GetItemString(row, L"GDNLineID") != L"")
- win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:GDNLineID:" + dw_list.GetItemString(row, L"GDNLineID"), 0);
+ SendMessage(hWndImageView, 0x401, (WPARAM)(L"xmRetrieve:GDNLineID:" + dw_list.GetItemString(row, L"GDNLineID"), 0).c_str());
else if (dw_list.GetItemString(row, L"ItemID") != L"")
- win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:SKUID:" + dw_list.GetItemString(row, L"ItemID"), 0);
+ SendMessage(hWndImageView, 0x401, (WPARAM)L"xmRetrieve:SKUID:" + dw_list.GetItemString(row, L"ItemID"), 0);
else if (dw_list.GetItemString(row, L"SKUID") != L"")
- win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:SKUID:" + dw_list.GetItemString(row, L"SKUID"), 0);
+ SendMessage(hWndImageView, 0x401, (WPARAM)L"xmRetrieve:SKUID:" + dw_list.GetItemString(row, L"SKUID"), 0);
else if (dw_list.GetItemString(row, L"GoodsNo") != L"")
- win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:GoodsNo:" + dw_list.GetItemString(row, L"GoodsNo"), 0);
+ SendMessage(hWndImageView, 0x401, (WPARAM)L"xmRetrieve:GoodsNo:" + dw_list.GetItemString(row, L"GoodsNo"), 0);
return 1;
}
int OnDWClick(ref TNotifyEvent evt, int p)
{
ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR);
- string value = hdr.data;
- string colname = hdr.colname;
+ xstring value = hdr.data;
+ xstring colname = hdr.colname;
int row = hdr.row;
if (row < 1) return 1;
if (rptEle)
{
- string str = rptEle.getAttribute(L"forward");
+ xstring str = rptEle.getAttribute(L"forward");
if (str == L"false") return 1;
}
/*
- string s = publiccode::GetUser().id;
+ xstring s = publiccode::GetUser().id;
xml supplier_x = ViewObject::RetrieveData(L"/sale/data/SupplierV3/entity/FindBySaleType",L"id", s);
- if(supplier_x.GetXmlDoc().text == L"样品间" || supplier_x.GetXmlDoc().text == L"主管"){
+ if(supplier_x.text == L"样品间" || supplier_x.text == L"主管"){
return 1;
}
xaserverarg arg;
if(colname==L"SONo")
{
- string SONo = dw_list.GetItemString(row,colname);
+ xstring SONo = dw_list.GetItemString(row,colname);
arg=new xaserverarg;
- arg.setNativePointer(arg.CreateInstance());
+
arg.AddArg(L"EntityNo",SONo);
arg.AddArg(L"ReadOnly",L"true");
OpenWindow(L"dev:xpage[base.maint.so.vx]",arg.getNativePointer());
}
if(colname==L"InvoiceNo")
{
- string InvoiceNo= dw_list.GetItemString(row,colname);
+ xstring InvoiceNo= dw_list.GetItemString(row,colname);
arg=new xaserverarg;
- arg.setNativePointer(arg.CreateInstance());
+
arg.AddArg(L"EntityNo",InvoiceNo);
arg.AddArg(L"ReadOnly",L"true");
OpenWindow(L"dev:xpage[maint.GDN3.vx]",arg.getNativePointer());
}
if(colname==L"InvoiceNoEx")
{
- string InvoiceNoEx= dw_list.GetItemString(row,colname);
+ xstring InvoiceNoEx= dw_list.GetItemString(row,colname);
arg=new xaserverarg;
- arg.setNativePointer(arg.CreateInstance());
+
arg.AddArg(L"EntityNo",InvoiceNoEx);
arg.AddArg(L"invoiceno",InvoiceNoEx);
arg.AddArg(L"ReadOnly",L"true");
@@ -327,7 +329,7 @@
}
*/
- if (hWndImageView != 0 && win32::IsWindow(hWndImageView))
+ if (hWndImageView != 0 && IsWindow(hWndImageView))
{
SendImageMessage(row);
}
@@ -348,7 +350,7 @@
int row = hdr.row;
if (row < 1) return 1;
- if (hWndImageView != 0 && win32::IsWindow(hWndImageView))
+ if (hWndImageView != 0 && IsWindow(hWndImageView))
{
SendImageMessage(row);
}
@@ -365,7 +367,7 @@
int CloseRetrieveTip()
{
dataretrieveing = false;
- win32::SendMessage(hWndRetrieveTip, 0x401, L"RetrieveFinished", 0);
+ SendMessage(hWndRetrieveTip, 0x401, L"RetrieveFinished", 0);
hWndRetrieveTip = 0;
return 1;
@@ -391,7 +393,7 @@
AttachEvent(L"dw_report", (0x400 + 81).toString(), OnRetrieveFinished);
}
- int OnRetrieve(string dataurl, string argstr)
+ int OnRetrieve(xstring dataurl, xstring argstr)
{
if (!rptEle) return 0;
if (dataretrieveing) return -1;
@@ -399,17 +401,17 @@
xml x = new.xml();
x.setNativePointer(xml::CreateInstance());
- xaserverarg arg = new xaserverarg;
- arg.setNativePointer(arg.CreateInstance());
+ xaserverarg arg ;
+
arg.AddArg(L"arg", argstr);
trace(argstr);
- string sheettype = rptEle.getAttribute(L"reporttype");
+ xstring sheettype = rptEle.getAttribute(L"reporttype");
if (sheettype == L"") sheettype = L"report";
//ShowRetrieveingTip();
if (url::get(dataurl, arg.GetString(), x) != 1)
{
- trace(L"错误信息=L" + x.GetXmlDoc().text);
+ trace(L"错误信息=L" + x.text);
dw_list.Redraw();
return -1;
}
@@ -438,12 +440,12 @@
return 1;
}
- xml getReportSet(string category)
+ xml getReportSet(xstring category)
{
xml x = new.xml();
x.setNativePointer(xml::CreateInstance());
- xaserverarg arg = new xaserverarg;
- arg.setNativePointer(arg.CreateInstance());
+ xaserverarg arg ;
+
arg.AddArg(L"category", category);
if (url::get(L"/sale/data/Total3/reportset", arg.GetString(), x) != 1)
{
@@ -452,17 +454,17 @@
return x;
}
- string GetReportFieldRole()
+ xstring GetReportFieldRole()
{
xml x = new.xml();
x.setNativePointer(xml::CreateInstance());
- xaserverarg arg = new xaserverarg;
- arg.setNativePointer(arg.CreateInstance());
+ xaserverarg arg ;
+
if (url::get(L"/sale/data/Total3/report/field", arg.GetString(), x) != 1)
{
return "";
}
- string str = x.GetXmlDoc().text;
+ xstring str = x.text;
return str;
}
@@ -481,19 +483,19 @@
m_category = L"total/trade";
if (GetParam()) {
- xaserverarg arg = new xaserverarg;
+ xaserverarg arg ;
arg.setNativePointer(GetParam());
m_category = arg.GetArgString(L"category");
}
xml x = getReportSet(m_category);
if (x)
{
- KXMLDOMNodeList nlist = x.GetXmlDoc().selectNodes(L"//reports/report");
+ KXMLDOMNodeList nlist = x.selectNodes(L"//reports/report");
int len = nlist.length;
for (int i = 0; i < len; i++)
{
KXMLDOMElement rpt = nlist.item(i);
- string name = rpt.getAttribute(L"name");
+ xstring name = rpt.getAttribute(L"name");
xcombobox::AddItem(xc.GetId(), name, trust(rpt as int));
if (i == 0) xc.SetText(name);
if (i == 0) rptEle = rpt;
diff --git a/jrj/xframe/xcontrol/xcombobox.hpp b/jrj/xframe/xcontrol/xcombobox.hpp
index fc2f128..4b7cafd 100644
--- a/jrj/xframe/xcontrol/xcombobox.hpp
+++ b/jrj/xframe/xcontrol/xcombobox.hpp
@@ -16,6 +16,12 @@
return *this;
}
public:
+ static int GetCurSel(HWND hWnd)
+ {
+ int CB_GETCURSEL_ = 0x0147;
+ return SendMessage(hWnd, CB_GETCURSEL_, 0, 0);
+ }
+
int GetCurSel()
{
int CB_GETCURSEL_ = 0x0147;
--
Gitblit v1.9.3