{
   "is_private" : null,
   "id" : "1-56X",
   "code" : "// Globally:\r\n\r\n(\r\n\tw = Window.new;\r\n\tz = w.view.flow{ |view|\r\n                  view.decorator.gap=0@0;\r\n\r\n\tButton(view,80@80).states_([[\"unhide\"],[\"hide\"]])\r\n\t.value_(1)\r\n\t.action_{ |but| if(but.value.booleanValue)\r\n\t\t{a[0..7].do(_.bounds= Rect(0,0,80,80)); z.reflowAll;\r\n\t\t//w.bounds = Rect(w.bounds.left, w.bounds.top,z.used.width,z.used.height)\r\n\t\t  }\r\n\t\t{a[0..7].do(_.bounds= Rect(0,0,0,0));  z.reflowAll;\r\n\t\t//w.bounds = Rect(w.bounds.left, w.bounds.top,z.used.width,z.used.height)\r\n\t\t }\r\n\t};\r\n\ta = 15.collect{ var c = CompositeView(view,80@80);\r\n\t\tSlider2D( c,80@80 ).background_( Color.rand ).resize_(5);\r\n\t\tc };\r\n\t};\r\n\tw.front;\r\n\tw.bounds = Rect(w.bounds.left, w.bounds.top,z.used.width,z.used.height)\r\n\r\n\r\n)\r\n\r\n// or individually:\r\n\r\n(\r\n\r\n   w = Window.new;\r\n       //change the gaps and margins to see how they work\r\n   z = w.view.flow{ |view|\r\n       view.decorator.gap=0@0;\r\n   a = 16.collect{ var c = CompositeView(view,80@100), sl;\r\n     sl=  Slider2D( c,Rect(0,20,80,80) ).background_( Color.rand );\r\n        b=SCButton(c,20@20).states_(\"x\").action_{\r\n                (c.bounds.width==20).if{\r\n                    c.bounds=c.bounds.width_(80);\r\n                    sl.visible_(true)}\r\n                    {c.bounds=c.bounds.width_(20);\r\n                    sl.visible_(false)};\r\n               \r\n                z.reflowAll;                \r\n                };\r\n        };\r\n   };\r\n   z.reflowAll;\r\n   w.front;\r\n\r\n\r\n)\r\n\r\n// Issues: gap is set to 0@0 therefore the views will have no spacing. This can be solved by making a margin with the CompositeView",
   "labels" : [
      "gui",
      "view"
   ],
   "description" : "Migration from the old SourceForge wiki.",
   "ancestor_list" : [],
   "author" : "codepool",
   "name" : "Collapsible Views"
}
