From de4c5b12eb264c9a5b8244fac8cea25e01be18be Mon Sep 17 00:00:00 2001
From: xj qian <qianxj15@sina.com>
Date: 星期三, 26 六月 2024 18:34:05 +0800
Subject: [PATCH] update folder data item
---
jrj/xframe/vbusiness/vframe/frame.vframe.vbusiness.hpp | 2 +-
jrj/project/business/Product.list.cpp | 3 +--
jrj/project/business/SO3.list.cpp | 20 ++++++++++----------
jrj/xframe/kobject/kxml.hpp | 12 ++++++++++++
4 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/jrj/project/business/Product.list.cpp b/jrj/project/business/Product.list.cpp
index ba30975..6311956 100644
--- a/jrj/project/business/Product.list.cpp
+++ b/jrj/project/business/Product.list.cpp
@@ -95,7 +95,7 @@
KXMLDOMElement OnGetCarListRowElement(int row = 0)
{
if (row < 1) row = dwc_list.GetRow();
- if (row < 1 || row > dwc_list.GetRowCount()) return 0;
+ if (row < 1 || row > dwc_list.GetRowCount()) return KXMLDOMElement();
KXMLDOMElement e = dw_list.GetRowElement(row);
return e;
}
@@ -1505,7 +1505,6 @@
{
agentFor = L"goodslib";
m_customer = 0;
- imageElement = 0;
OnAttachEvent();
diff --git a/jrj/project/business/SO3.list.cpp b/jrj/project/business/SO3.list.cpp
index f5af146..0ce958f 100644
--- a/jrj/project/business/SO3.list.cpp
+++ b/jrj/project/business/SO3.list.cpp
@@ -46,9 +46,9 @@
if (len > 0) tv_folder.SetItemChild(hItem, 1);
for (int i = 0; i < len; i++)
{
- KXMLDOMElement& e = * new KXMLDOMElement(nlist.item(i));
+ KXMLDOMElement e = nlist.item(i);
string name = e.getAttribute(L"name");
- HTREEITEM h = tv_folder.InsertChildItem(hItem, name, (LPARAM)&e, image);
+ HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e.ptr(), image);
ExpandCatChildFolder(h, e, 35);
}
return 1;
@@ -62,9 +62,9 @@
int len = nlist.length();
for (int i = 0; i < len; i++)
{
- KXMLDOMElement& e = *new KXMLDOMElement(nlist.item(i));
+ KXMLDOMElement e = nlist.item(i);
string name = e.getAttribute(L"name");
- HTREEITEM h = tv_folder.InsertChildItem(hItem, name, (LPARAM)&e, 35);
+ HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e.ptr(), 35);
ExpandCatChildFolder(h, e, 35);
}
return 1;
@@ -79,7 +79,7 @@
string name = tv_folder.GetItemLabel(hTopItem);
HTREEITEM child = tv_folder.GetChildItem(hItem);
- KXMLDOMElement& e = *(KXMLDOMElement*)tv_folder.GetItemData(hItem);
+ KXMLDOMElement e = tv_folder.GetItemData(hItem);
if (!child)ExpandFolderItem(hItem, e.getAttribute(L"no"));
return 1;
@@ -92,15 +92,15 @@
int len = nlist.length();
for (int i = 0; i < len; i++)
{
- KXMLDOMElement& e = *new KXMLDOMElement(nlist.item(i));
+ KXMLDOMElement e = nlist.item(i);
string name = e.getAttribute(L"name");
xstring sImage = e.getAttribute(L"image");
xstring child = e.getAttribute(L"child");
int image = 15;
if (sImage) image = sImage.toInt();
- HTREEITEM h = tv_folder.InsertChildItem(hItem, name, (LPARAM)&e, image);
+ HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e.ptr(), image);
if (child != L"no") tv_folder.SetItemChild(h, 1);
- ExpandChildFolder(h, e);
+ //ExpandChildFolder(h, e);
}
return 1;
}
@@ -170,7 +170,7 @@
if (!hItem) return 1;
HCURSOR hCursor = xutil::SetCursorWait();
- KXMLDOMElement& e1 = *(KXMLDOMElement*)tv_folder.GetItemData(hItem);
+ KXMLDOMElement e1 = tv_folder.GetItemData(hItem);
string no = e1.getAttribute(L"no");
KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),myDataUrl, L"no", no, L"QueryTxt", m_QueryTxt, L"rows", rows);
if (x)
@@ -499,7 +499,7 @@
{
HTREEITEM hItem = tv_folder.GetCaretItem();
if (hItem ) return 1;
- KXMLDOMElement& e = *(KXMLDOMElement*)tv_folder.GetItemData(hItem);
+ KXMLDOMElement e = tv_folder.GetItemData(hItem);
xstring no = e.getAttribute(L"no");
if (no.find(L"Customer:") >= 0)
{
diff --git a/jrj/xframe/kobject/kxml.hpp b/jrj/xframe/kobject/kxml.hpp
index d3c41a1..050b9e5 100644
--- a/jrj/xframe/kobject/kxml.hpp
+++ b/jrj/xframe/kobject/kxml.hpp
@@ -133,6 +133,16 @@
KXMLDOMNode(const KXMLDOMNode& rhs);
const KXMLDOMNode& operator =(const KXMLDOMNode& rhs);
public:
+ unsigned long AddRef();
+ unsigned long Release();
+ public:
+ LPARAM ptr()
+ {
+ this->AddRef();
+ return (LPARAM)this->getImpl();
+ }
+ KXMLDOMNode(LPARAM p) :KXMLDOMNode((void*)p) {}
+ public:
operator bool() { return impl ? true : false; }
public:
void* getImpl();
@@ -199,6 +209,8 @@
KXMLDOMElement( KXMLDOMNode v);
KXMLDOMElement(void* impl) :KXMLDOMNode(impl) {}
KXMLDOMElement() :KXMLDOMNode() {}
+ public:
+ KXMLDOMElement(LPARAM p) :KXMLDOMNode((void*)p) {}
};
class KXMLDOMAttribute : public KXMLDOMNode
{
diff --git a/jrj/xframe/vbusiness/vframe/frame.vframe.vbusiness.hpp b/jrj/xframe/vbusiness/vframe/frame.vframe.vbusiness.hpp
index e7e2c89..550e593 100644
--- a/jrj/xframe/vbusiness/vframe/frame.vframe.vbusiness.hpp
+++ b/jrj/xframe/vbusiness/vframe/frame.vframe.vbusiness.hpp
@@ -7,7 +7,7 @@
{
public:
xframe(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {
- this->SetArg(this->GetWinParam());
+ this->SetArg();
}
static int getUrl(string url1, string para, KXMLDOMDocument x)
--
Gitblit v1.9.3