type t_dir_list=class(tdcreateform) uses tslvcl; lst_dir:tlistbox; btn_add:tbtn; btn_del:tbtn; btn_ok:tbtn; f_d:tfolderchooseadlg; f_f:topenfileadlg; function Create(AOwner);override; //构造 begin inherited; end function btn_ok_clk(o;e);virtual; begin //Visible := false; EndModal(1); end function btn_del_clk(o;e);virtual; begin idx := lst_dir.ItemIndex; if idx>=0 then begin lst_dir.DeleteItem(idx); end end function btn_add_clk(o;e);virtual; begin if fopentype then begin f_f.filter := fopentype ; if f_f.OpenDlg() then begin r := f_f.filename; lst_dir.AppendItem(r); end return ; end if f_d.OpenDlg() then begin r := f_d.Folder; lst_dir.AppendItem(r); end end function get_dirs(); begin return lst_dir.Items; end function set_dirs(ls); begin lst_dir.Items := ls; end function dir_list_close(o;e);virtual; begin e.skip := true; EndModal(0); end fopentype; function Recycling();override; //回收变量 begin inherited; ci := self.classinfo(); //将成员变量赋值为nil避免循环引用 for i,v in ci["members"] do begin if v["const"] then continue; if v["static"] then continue; invoke(self,v["name"],nil); end end end