| 1.采用了 “3.各种下拉” 中的Freeform，外观稍作了修改：动态增加了2个“收拢”的按钮，能触发收拢、展开的事件; 2.点击按钮，事件中执行了显示/隐藏 TableLayout;

1.可查看创建该Freeform的XML描述文件，里面有2个TableLayout, 但外观作了改动，例如增加了2个按钮：
    function OnReady(id)
    {
     AF.func("Build", "treelist/freeform3.xml");
     AF.func("SetObjProp", "group1 \r\n titleOffset \r\n 96");
     AF.func("SetObjProp", "group2 \r\n titleOffset \r\n 96");

     AF.func("SetObjProp", "group1 \r\n text \r\n 基本信息");
     AF.func("SetObjProp", "group2 \r\n text \r\n 货运信息");

     AF.func("SetObjProp", "group1 \r\n titleHeight \r\n 20");
     AF.func("SetObjProp", "group2 \r\n titleHeight \r\n 20");
     AF.func("SetObjProp", "group2 \r\n round \r\n 12");

     AF.func("AddObject", "input \r\n id=btn1; type=button; text=收拢; x=group1.x + 10; y=group1.y -1; height=26; width=70; style=flat,transparent; icon=treelist/pm.zip#minus.ico; at=left");
     AF.func("AddObject", "input \r\n id=btn2; type=button; text=收拢; x=group2.x + 10; y=group2.y -1; height=26; width=70; style=flat,transparent; icon=treelist/pm.zip#minus.ico; at=left");
    }
2.按钮的点击事件的全部js源码如下：
    var closed1=false, closed2=false;
    function OnEvent(id, Event, p1, p2, p3, p4)
    {
      if(Event != "ButtonClicked") return;
      if(p1 == "btn1") closed1 = !closed1;
      else if(p1 == "btn2") closed2 = !closed2;

      if(closed1) {
       AF.func("SetObjProp", "btn1 \r\n text \r\n 展开");
       AF.func("SetObjProp", "btn1 \r\n img \r\n treelist/pm.zip#plus.ico");
       AF.func("SetObjProp", "layout1 \r\n visible \r\n false");	//layout
       AF.func("SetObjProp", "group1 \r\n height \r\n 28");
      }
      else {
       AF.func("SetObjProp", "btn1 \r\n text \r\n 收拢");
       AF.func("SetObjProp", "btn1 \r\n img \r\n treelist/pm.zip#minus.ico");
       AF.func("SetObjProp", "group1 \r\n height \r\n 170");
       AF.func("SetObjProp", "layout1 \r\n visible \r\n true");		//layout
      }

      if(closed2) {
       AF.func("SetObjProp", "btn2 \r\n text \r\n 展开");
       AF.func("SetObjProp", "btn2 \r\n img \r\n treelist/pm.zip#plus.ico");
       AF.func("SetObjProp", "layout2 \r\n visible \r\n false");	//layout
       AF.func("SetObjProp", "group2 \r\n height \r\n 28");
      }
      else {
       AF.func("SetObjProp", "btn2 \r\n text \r\n 收拢");
       AF.func("SetObjProp", "btn2 \r\n img \r\n treelist/pm.zip#minus.ico");
       AF.func("SetObjProp", "group2 \r\n height \r\n 160");
       AF.func("SetObjProp", "layout2 \r\n visible \r\n true");		//layout
      }
    }
可见，如果TableLayout隐藏了，那么嵌在里面的输入控件也全部隐藏。