Containers

Containers, or controls that allow us to embed another control, are typically identified by the existence of a SetChild() or SetMargined() function in their type definition. As these controls embed one another, a margin around the content is often desirable—this is the outer equivalent of the padding in ui.Box. This can be turned on using SetMargined(true), and the system-defined margin size will be introduced around the child control.

The following containers are defined as part of andlabs UI:

  • Window controls describe an application window and are the main entry point for an andlabs UI graphical application. The main content is set using SetChild(). Margins should probably be switched on if it's a simple content window, or left off if you are adding further container controls.
  • Group defines a frame around a child widget (assigned with SetChild()) with a title (passed to ui.NewGroup()). The appearance of the group control will vary across systems; on some it may be a box around the child, and on others it may be invisible. As with the window controls, you should consider the child content before deciding whether the margins should be enabled.
  • Tab is slightly different from the others, as it may contain multiple child controlsbut only one is visible at a time. As there are multiple child controls, the method to add the child is Append(string, Control)the first parameter is the title to be displayed on the tab and the second is the child for this new tab. To accommodate multiple child controls, the margin control is adapted alsoyou will need to call SetMargined(int, bool) where the first parameter is the tab index, and the latter is the usual parameter to turn margins on or off.

That's all of the controls that manage others, let's look at the details of the main widgets that an andlabs UI application is constructed from.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.137.12