LiFan
2024-07-17 bf115a00a40d3af1fae7521d38b9b2ca70fcc161
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
use"lang.vl"
use "win.vl"
use "dev:vm[xdwgrid.vm]"
 
unit vbusiness.vpage
[
    BindComputerDlgNew is extend win__;
    about BindComputerDlgNew
    [
        field:
            
        method:
        [
            xdwgrid__    dw_list;
            int  OnRetrieve()
            {
                xml__ x = new xml__;
                x.setNativePointer(xml__ ::CreateInstance());
 
                xaserverarg__ arg=new xaserverarg__;
                arg.setNativePointer(arg.CreateInstance());    
                arg = this.GetParam();    
                if(arg.GetArgString("BindComputer"))
                {    
                    string sbys= arg.GetArgString("BindComputer");
                    //alert(sbys);
                    x.LoadXml(sbys);
                    
                }
                else
                {    
 
                    x.LoadXml("<args></args>");    
                }    
 
                dw_list.Retrieve(x.GetXmlDoc().selectSingleNode("args"));        
                dw_list.ResetUpdateStatus();
                dw_list.Redraw();
                return 1;
            }
            int OnAddRow(xdwgrid__ dw)
            {
                dw.InsertRow(0);
                return 1;
            }
            
            int OnDelRow(xdwgrid__ dw)
            {
                int row = dw.GetRow();
                if(row<1 || row > dw.GetRowCount()) return -1;
                dw.DeleteRow(row);            
                return 1;
            }                
            //ÃüÁî·¢²¼º¯Êý
            int OnCmdDispatch(string comdid)
            {
                dw_list.AcceptText();
                xaserverarg__ arg = new xaserverarg__;
                arg.setNativePointer(arg.CreateInstance());                            
                arg = win__::GetParam();
                arg.AddArg("comdid",comdid);                
                if (comdid=="ok")
                {
                    xml__ x = new xml__;
                    x.setNativePointer(xml__ ::CreateInstance());
                    dw_list.DwUpdateAllTo(x.GetXmlDoc());
                    arg.AddArg("xml",x.GetXml());            
                    CloseWindow();
                }
                else if(comdid=="close")
                    CloseWindow();
                else if(comdid == "add")
                    OnAddRow(dw_list);
                else if(comdid == "del")
                    OnDelRow(dw_list);                
                return 0;
            }
            
            //ÃüÁî´¦Àíʼþ
            int OnXCommand(ref TXCommandEvent evt,int p)
            {
                return OnCmdDispatch(evt.pStrID);
            }
            
            int OnAttachEvent()
            {
                //°ó¶¨¹¤¾ßÌõµã»÷ʼþ
                AttachEvent("WM_XCOMMAND",OnXCommand);
            }
            int onload()
            {
                OnAttachEvent();
            
                dw_list = new xdwgrid__;
                dw_list.setNativePointer(GetControl("dw_list"));
                dw_list.SetDataObject(GetServerUrl(),"dev:sheet[SysUser.tpl/BindComputer]");
                dw_list.SetReadOnly(true);
                if(this.GetParam())
                {                
                    OnRetrieve();
                }
                return 1;
            }            
        ]
    ]
]