| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "dev:code[pa.tpp]" |
| | | use "dev:vm[control.vm]" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | unit vbusiness.xpage tpp |
| | | [ |
| | | class pa |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) AddUserGroup : public xwin |
| | | { |
| | | string note; |
| | | |
| | | public: |
| | | xstring note; |
| | | int hitem; |
| | | int row; |
| | | int wid; |
| | | treeview__ tv; |
| | | xdwgrid__ dw; |
| | | win__ pwin; |
| | | xtreeview tv; |
| | | xdwgrid dw; |
| | | xwin pwin; |
| | | |
| | | public: |
| | | AddUserGroup(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static AddUserGroup* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | AddUserGroup* pWin = new AddUserGroup(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | ] |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | |
| | | AddUserGroup is extend win__; |
| | | about AddUserGroup |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | pa p; |
| | | |
| | | int SetAgent() |
| | | { |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | int SetAgent(); |
| | | |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | int AppendItem(xml__ x,msxml::IXMLDOMElement r,string item){ |
| | | var e = x.GetXmlDoc().createElement(item); |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl(item)); |
| | | e.text = xc.GetText(); |
| | | int AppendItem(xml x, KXMLDOMElement r, xstring item) { |
| | | var e = x.createElement(item); |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(item)); |
| | | e.text() = xc.GetText(); |
| | | r.appendChild(e); |
| | | return 1; |
| | | } |
| | | int AppendAttrib(xml__ x,msxml::IXMLDOMElement r,string item){ |
| | | var e = x.GetXmlDoc().createElement(item); |
| | | int AppendAttrib(xml x, KXMLDOMElement r, xstring item) { |
| | | var e = x.createElement(item); |
| | | //xcontrol xc = GetControl(item); |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl(item)); |
| | | e.text = xc.GetText(); |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(item)); |
| | | e.text() = xc.GetText(); |
| | | r.setAttribute(item,xc.GetText()); |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid=="cb_cancel") |
| | | if (comdid == L"cb_cancel") |
| | | CloseWindow(); |
| | | else if(comdid=="cb_ok") |
| | | else if (comdid == L"cb_ok") |
| | | { |
| | | int wid = p.wid; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | x.LoadXml("<row/>"); |
| | | var r = x.GetXmlDoc().documentElement; |
| | | string gpguid; |
| | | if (p.note=="修改") |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | x.loadXML(L"<row/>"); |
| | | var r = x.documentElement(); |
| | | xstring gpguid; |
| | | if (p.note == L"修改") |
| | | { |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid,p.hitem); |
| | | gpguid=ele.selectSingleNode("@JobID").text; |
| | | KXMLDOMElement ele = treeview::GetItemData(wid, p.hitem); |
| | | gpguid = ele.selectSingleNode(L"@JobID").text(); |
| | | } |
| | | else |
| | | gpguid=win__::GetGuid(); |
| | | r.setAttribute("JobID",gpguid); |
| | | AppendAttrib(x,r,"JobName"); |
| | | AppendAttrib(x,r,"JobType"); |
| | | //AppendItem(x,r,"JobName"); |
| | | //AppendItem(x,r,"JobType"); |
| | | //trace(x.GetXml()); |
| | | gpguid = GetGuid(); |
| | | r.setAttribute(L"JobID", gpguid); |
| | | AppendAttrib(x, r, L"JobName"); |
| | | AppendAttrib(x, r, L"JobType"); |
| | | //AppendItem(x,r,L"JobName"); |
| | | //AppendItem(x,r,L"JobType"); |
| | | //trace(x.xml()); |
| | | //return 1; |
| | | arg.AddArg("content",x.GetXml()); |
| | | if (xaserver__::ExecXAction(GetServerUrl(),"[update.Usergroup.xa]",arg.GetString())==1) |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (xaserver::ExecXAction(GetServerUrl(), L"[update.Usergroup.xa]", arg.GetString()) == 1) |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl("JobName")); |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(L"JobName")); |
| | | //p.tv.Redraw(); |
| | | if (p.note=="修改") |
| | | if (p.note == L"修改") |
| | | { |
| | | treeview__::SetItemData(wid,p.hitem,r); |
| | | treeview__::SetItemLabel(wid,p.hitem,xc.GetText()); |
| | | treeview::SetItemData(wid, p.hitem, r); |
| | | treeview::SetItemLabel(wid, p.hitem, xc.GetText()); |
| | | } |
| | | else |
| | | { |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::InsertChildItem(wid,root,xc.GetText(),r,15); |
| | | int root = treeview::GetRootItem(wid); |
| | | treeview::InsertChildItem(wid, root, xc.GetText(), r, 15); |
| | | } |
| | | CloseWindow(); |
| | | } |
| | | else |
| | | { |
| | | alert("保存出错!"); |
| | | alert(L"保存出错!"); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&AddUserGroup::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&AddUserGroup::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | |
| | | return 1; |
| | | } |
| | | |
| | | int SetItem(string value,string item){ |
| | | control__ xc = new control__; |
| | | int SetItem(xstring value, xstring item) { |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(item)); |
| | | xc.SetText(value); |
| | | return 1; |
| | |
| | | OnInitial(); |
| | | p = new pa; |
| | | |
| | | if(this.GetParam()) |
| | | if (GetWinParam()) |
| | | { |
| | | p=GetParam(); |
| | | win__::SetWindowText(GetHWND(),p.note+"用户组"); |
| | | if (p.note=="修改") |
| | | p = GetArg(); |
| | | SetWindowText(GetHWND(), p.note + L"用户组"); |
| | | if (p.note == L"修改") |
| | | { |
| | | int wid = p.wid; |
| | | msxml::IXMLDOMElement ele=treeview__::GetItemData(wid,p.hitem); |
| | | KXMLDOMElement ele = treeview::GetItemData(wid, p.hitem); |
| | | //trace(ele.xml); |
| | | //SetItem(ele.selectSingleNode("gpno").text,"gpno"); |
| | | //SetItem(ele.selectSingleNode("gpname").text,"gpname"); |
| | | string ls_guid = ele.selectSingleNode("@JobID").text; |
| | | string ls_name = ele.selectSingleNode("@JobName").text; |
| | | string ls_type = ele.selectSingleNode("@JobType").text; |
| | | SetItem(ls_guid,"JobID"); |
| | | SetItem(ls_name,"JobName"); |
| | | SetItem(ls_type,"JobType"); |
| | | //SetItem(ele.selectSingleNode(L"gpno").text(),L"gpno"); |
| | | //SetItem(ele.selectSingleNode(L"gpname").text(),L"gpname"); |
| | | xstring ls_guid = ele.selectSingleNode(L"@JobID").text(); |
| | | xstring ls_name = ele.selectSingleNode(L"@JobName").text(); |
| | | xstring ls_type = ele.selectSingleNode(L"@JobType").text(); |
| | | SetItem(ls_guid, L"JobID"); |
| | | SetItem(ls_name, L"JobName"); |
| | | SetItem(ls_type, L"JobType"); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | }; |