pub fn write_binding_file(&self,p: &mut PathBuf,ui_path_vec: &mut Vec<String>) {
        //root name can be "r" or "t" in the ui tree,so write it in template,here use empty string instead
        if let ContainerType::Root = self.tp {
            ui_path_vec.push(String::new());
            self.write_binding_mod(p);
        }else{
            ui_path_vec.push(self.name.var_name.clone());
        }

        //path container or ctrl in the ui tree
        let ui_path = ui_path_vec.join(".");
        //write child binding first
        for (_,child) in &self.children {
            child.write_binding_file(p,ui_path_vec);
        }
        ui_path_vec.pop().unwrap();

        //all container call register handler of all it's children
        let children_register = self.children.iter().map(|(_,child)|{
            format!(tpl_binding!(call_child),var_name=child.name.var_name)
        }).collect::<Vec<_>>().concat().trim().to_string();

        //add use in file
        let use_children_mod = self.children.iter().map(|(_,child)|{
            format!(tpl_binding!(use_child),var_name=child.name.var_name)
        }).collect::<Vec<_>>().concat().trim().to_string();
        //different container will give it's own impl
        let mut this_handler = String::new();
        match self.tp {
            ContainerType::Dialog=>{
                let ctrl_binding = self.format_ctrl_binding(&ui_path);
                this_handler = format!(tpl_binding!(dlg),ui_path=ui_path,ctrl_binding=ctrl_binding);
            }
            _=>{}
        }

        //create file
        p.push(format!("{}.rs",self.name.var_name));
        let mut f = File::create(p.as_path().clone()).unwrap();
        p.pop();

        //only root dialog write this
        //writeln!(f,"\t\tr.main_dialog.this_msg().on_close(|_,_|{\r\n\t\t\tunsafe{user32::PostQuitMessage(0)};\r\n\t\t});").unwrap();
        //write file
        let content = format!(tpl_binding!(),use_children_mod=use_children_mod,this_handler=this_handler,children_register=children_register);
        f.write_all(content.as_bytes());
    }
/// write default handler that binds all controls
/// p: file path, ui_path: container in the ui tree path

write default handler that binds all controls
p: file path, ui_path: container in the ui tree path
write default handler that binds all controls p : file path ui_path : container in the ui tree path
pub fn write_binding_file(&self,p: &mut PathBuf,ui_path_vec: &mut Vec<String>) {
        //root name can be "r" or "t" in the ui tree,so write it in template,here use empty string instead
        if let ContainerType::Root = self.tp {
            ui_path_vec.push(String::new());
            self.write_binding_mod(p);
        }else{
            ui_path_vec.push(self.name.var_name.clone());
        }
        //path container or ctrl in the ui tree
        let ui_path = ui_path_vec.join(".");
        //write child binding first
        for (_,child) in &self.children {
            child.write_binding_file(p,ui_path_vec);
        }
        ui_path_vec.pop().unwrap();
        //all container call register handler of all it's children
        let children_register = self.children.iter().map(|(_,child)|{
            format!(tpl_binding!(call_child),var_name=child.name.var_name)
        }).collect::<Vec<_>>().concat().trim().to_string();
        //add use in file
        let use_children_mod = self.children.iter().map(|(_,child)|{
            format!(tpl_binding!(use_child),var_name=child.name.var_name)
        }).collect::<Vec<_>>().concat().trim().to_string();
        //different container will give it's own impl
        let mut this_handler = String::new();
        match self.tp {
            ContainerType::Dialog=>{
                let ctrl_binding = self.format_ctrl_binding(&ui_path);
                this_handler = format!(tpl_binding!(dlg),ui_path=ui_path,ctrl_binding=ctrl_binding);
            }
            _=>{}
        }
        //create file
        p.push(format!("{}.rs",self.name.var_name));
        let mut f = File::create(p.as_path().clone()).unwrap();
        p.pop();
        //only root dialog write this
        //writeln!(f,"\t\tr.main_dialog.this_msg().on_close(|_,_|{\r\n\t\t\tunsafe{user32::PostQuitMessage(0)};\r\n\t\t});").unwrap();
        //write file
        let content = format!(tpl_binding!(),use_children_mod=use_children_mod,this_handler=this_handler,children_register=children_register);
        f.write_all(content.as_bytes());
    }
pub fn write_binding_file ( & self , p : & mut PathBuf , ui_path_vec : & mut Vec < String > ) { //root name can be "r" or "t" in the ui tree,so write it in template,here use empty string instead
 if let ContainerType :: Root = self . tp { ui_path_vec . push ( String :: new ( ) ) ; self . write_binding_mod ( p ) ; } else { ui_path_vec . push ( self . name . var_name . clone ( ) ) ; } //path container or ctrl in the ui tree
 let ui_path = ui_path_vec . join ( " " ) ; //write child binding first
 for ( _ , child ) in & self . children { child . write_binding_file ( p , ui_path_vec ) ; } ui_path_vec . pop ( ) . unwrap ( ) ; //all container call register handler of all it's children
 let children_register = self . children . iter ( ) . map ( | ( _ , child ) | { format ! ( tpl_binding ( call_child ) var_name child name var_name ) } ) . collect :: < Vec < _ > > ( ) . concat ( ) . trim ( ) . to_string ( ) ; //add use in file
 let use_children_mod = self . children . iter ( ) . map ( | ( _ , child ) | { format ! ( tpl_binding ( use_child ) var_name child name var_name ) } ) . collect :: < Vec < _ > > ( ) . concat ( ) . trim ( ) . to_string ( ) ; //different container will give it's own impl
 let mut this_handler = String :: new ( ) ; match self . tp { ContainerType :: Dialog => { let ctrl_binding = self . format_ctrl_binding ( & ui_path ) ; this_handler = format ! ( tpl_binding ( dlg ) ui_path ui_path ctrl_binding ctrl_binding ) ; } _ => { } } //create file
 p . push ( format ! ( " " self name var_name ) ) ; let mut f = File :: create ( p . as_path ( ) . clone ( ) ) . unwrap ( ) ; p . pop ( ) ; //only root dialog write this
 //writeln!(f,"\t\tr.main_dialog.this_msg().on_close(|_,_|{\r\n\t\t\tunsafe{user32::PostQuitMessage(0)};\r\n\t\t});").unwrap();
 //write file
 let content = format ! ( tpl_binding ( ) use_children_mod use_children_mod this_handler this_handler children_register children_register ) ; f . write_all ( content . as_bytes ( ) ) ; }
write default handler that binds all controls
p: file path, ui_path: container in the ui tree path
write default handler that binds all controls p : file path ui_path : container in the ui tree path
&self
p
&mut PathBuf
ui_path_vec
&mut Vec<String>
&self
p
&mut PathBuf
ui_path_vec
&mut Vec<String>