Skip to content
TomCrypto edited this page Dec 17, 2014 · 2 revisions

You can create a group as follows for instance:

var myGroup = new Group(myBar, "A group", myVar);
/* or */
var myGroup = new Group(myBar);
myVar.Group = myGroup;
myGroup.Label = "A group";

You can nest groups into groups by using the Parent property of groups, and you can change their labels (so you can have two groups with the same label if you want). Note null is a valid group which represents the root of the bar (i.e. no group). There are three gotchas to watch out for when using groups:

  • A group only exists as long as there are variables under said group. This means that until you assign a variable to a group, you cannot modify the group's label or any of its properties. As a result, the Group class supports two kinds of initializations: lazy initialization, where you can create a non-existent group, assign it to a bunch of variables (which truly creates it) and configure it afterwards, or direct initialization, where the constructor takes a collection of initial variables to put under the group. Use whichever one is more convenient for you.

  • A group ceases to exist as soon as there are no more variables under said group. This is not a big problem, it's just important to keep that in mind when dynamically creating variables as it may invalidate Group instances you are holding.

  • Take care when putting groups into groups: if you put group A into group B, and then put group B into group A, both groups and all variables contained in them will be destroyed (this is done automatically by the native library). In general, avoid circular group references and use the null group to break such circular references.


  • High-level wrapper
  • Integration
    • [Event handling](Event handling)
    • [Organizing variables](Organizing variables)
    • [Error handling](Error handling)
    • Scripting
    • [Exception safety](Exception safety)
    • [Thread safety](Thread safety)
  • Technical manual
    • Context
    • Bar
    • Group
    • IntVariable
    • FloatVariable
    • DoubleVariable
    • BoolVariable
    • EnumVariable
    • StringVariable
    • ColorVariable
    • Color4Variable
    • VectorVariable
    • QuaternionVariable
    • StructVariable
    • Button
    • Separator
    • ...
  • [Low-level wrapper](Low-level wrapper)
Clone this wiki locally