LiFan
2024-07-18 e5c63266146b8fc3a527920ffbced686d514e1fb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
use "xcontrol.vframe.vbusiness.vd"
use "xbase.vframe.vbusiness.vd"
use "base.view.vd"
unit trade 
[
    class DocFileSaveDlg:  public xframe
    {
        xlistview  lv_view;
        xnode    m_agentNode;    //Agent Condition
        int columnCount ;
    
        //½¹µã¼¤»î´¦Àíº¯Êý
        int OnSetFocus(ref TEvent evt,int param)
        {
            //ÖØÖù¤¾ßÌõ
            return 1;
        }
 
 
        //ÃüÁî·¢²¼º¯Êý
        int OnCmdDispatch(string comdid)
        {
            if(comdid=="xmOk")
            {
                string filename = GetControl("filename").GetText();
                if(filename=="") return 1;
                xaserverarg arg = GetParam();
                if(!arg) return 1;
                arg.AddArg("result","ok");
                arg.AddArg("filename",filename);
                CloseWindow();
                return 1;
            }
            else if(comdid=="xmCancel")
            {
                CloseWindow();
                return 1;
            }
            return 0;
        }
        
        //ÃüÁî´¦Àíʼþ
        int OnXCommand(ref TXCommandEvent evt,int param)
        {
            return OnCmdDispatch(evt.pStrID);
        }
        
        int OnAttachEvent()
        {
            //°ó¶¨¹¤¾ßÌõµã»÷ʼþ
            AttachEvent("WM_XCOMMAND",OnXCommand);
            //»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ
            AttachEvent("WM_SETFOCUS",OnSetFocus);
        }
        
    
        int SetListViewHeaderColumn(string Url)
        {
            const int LVCFMT_LEFT = 0;
            for(int i=0;i<3;i++)  lv_view.DeleteColumn(lv_view.GetId(),1);
            lv_view.InsertColumn(lv_view.GetId(),0,"´´½¨ÈËÔ±",LVCFMT_LEFT,80,0);
            lv_view.InsertColumn(lv_view.GetId(),0,"´´½¨ÈÕÆÚ",LVCFMT_LEFT,80,0);
            lv_view.InsertColumn(lv_view.GetId(),0,"Ãû³Æ",0,120,0);
            columnCount = 3;
            return 1;
        }
 
        int Retrieve(string src)
        {
            xml x = ViewObject::RetrieveData("/sale/data/TDocument3/folder/list", "src",src);
            if(x)
            {
                msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement;
                msxml::IXMLDOMNodeList nlist=ele.SelectNodes("*");
                int s=nlist.length;
                if (s>0)
                {
                    for (int i=0; i<s; i++)
                    {
                        msxml::IXMLDOMElement e=nlist.item(i);
                        string name=e.getAttribute("caption");
                        int nItem = xlistview::InsertItemEx(lv_view.GetId(),0,name,23,cast(e as int));
                        
                        xlistview::SetItemText(lv_view.GetId(),nItem,1,e.getAttribute("Creator"));
                        xlistview::SetItemText(lv_view.GetId(),nItem,2,e.getAttribute("CreateDate"));
                    }        
                }
            }
            return 1;
        }
        
        int onload()
        {
            lv_view = GetControl("lv_view");
            //xlistview::SetdwStyle(lv_view.GetId(),0);
                
            columnCount = 0;
            SetListViewHeaderColumn("");
            OnAttachEvent();
            
            if(GetParam())
            {
                xaserverarg arg = GetParam();
                string src = arg.GetArgString("src");
                Retrieve(src);
            }
            
            return 1;
        }
        
        int onloaded()
        {
            //SetAgent();            
            
            return 1;
        }        
    };
]