LiFan
2024-09-02 23b9b945450e9daf7b13b705c028c444bb2051d3
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
use "dev:code[Data.resource.config.vx]"
 
unit vbusiness.vpage
[
    resourceselectRole is extend DataRConfig;
    about resourceselectRole
    [
        field:
            
        method:
        [
            int ForChild()
            {
                this.dw_list.SetReadOnly(true);
                return 0;
            }        
        
            int OnSelectAll()
            {
                if(this.dw_list.GetRowCount() > 0 )
                    this.dw_list.SelectRow(1,true);
 
                this.dw_list.SelectRow(0,true);
                this.dw_list.Redraw();
                return 1;
            }
            
            int OnSelectNo()
            {
                this.dw_list.SelectRow(0,false);
                this.dw_list.Redraw();
                return 1;
            }
            
            int OnOk()
            {
                xdwgrid__ dw_param = this.GetParam();
                if (dw_param)
                {
                    int row = this.dw_list.GetNextSelectRow(1);
                    int dw_row = dw_param.GetRowCount();
                    while (row>0){
                        msxml::IXMLDOMElement e = this.dw_list.GetRowElement(row);
                        string scetegory = e.selectSingleNode("cetegory").text;
                        string sResource = e.selectSingleNode("resource").text;
                        string sName = e.selectSingleNode("name").text;
                        string sResConfigID = e.selectSingleNode("ResConfigID").text;
                        dw_row += 1;
                        dw_param.InsertRow(-1);
                        dw_param.SetItemString(dw_row,"cetegory",scetegory);
                        dw_param.SetItemString(dw_row,"resource",sResource);
                        dw_param.SetItemString(dw_row,"name",sName);
                        dw_param.SetItemString(dw_row,"ResConfigID",sResConfigID);
                    
                        this.dw_list.SelectRow(row,false);
                        row = this.dw_list.GetNextSelectRow(row + 1);
                    }
                    this.dw_list.Redraw();
                }    
                CloseWindow();
                return 1;
            }
            
            int OnCancel()
            {
                win__::CloseWindow();        
                return 1;
            }
 
            int OnCmdDispatch(xstring comdid)
            {
                if (comdid=="SelectAll") OnSelectAll();
                else if (comdid=="SelectNo") OnSelectNo();
                else if (comdid=="Ok") OnOk();
                else if (comdid=="Cancel") OnCancel();                    
                return 0;
            }
            
            int OnXCommand(ref TXCommandEvent evt,int p)
            {
                return OnCmdDispatch(evt.pStrID);
            }
            
            int onload()
            {
                DataRConfig::onload();
                this.dw_list.SetSelectionMode(3);
                
                AttachEvent("WM_XCOMMAND",OnXCommand);
            }
        ]
    ]
]