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); 
 | 
            } 
 | 
        ] 
 | 
    ] 
 | 
] 
 |