GMGridContainer:
Filter:
GraphicalModule/Classes (extension) | GUI > Graphical Module

GMGridContainer
ExtensionExtension

A simple UserView container that automatically arranges its children into a grid

Description

GMGridContainer is a layout utility class that will arrange its children according to a grid, trying to allocate an even space to every widget.

Contrary to most Graphical Module classes, it does not inherit from GMUserView.

Usage

To use this class, one must instanciate it, then use the insertView to insert views inside it :

insertView takes the view as mandatory argument, then an optionnal index argument. If none is provided, the view will be inserted last in the grid. When the view is inserted, the GMGridContainer will be set as its parent.

Removing views

One can use the removeView method to remove a view from the grid. However, this only removes the view from the GMGridContainer internal view list : the view will be removed from the display calculation, but will continue to exist as a child of the GMGridContainer. Depending on your needs, you also need to either remove the widget using its destroy method, or assign a new parent to it using setParent.

onResize function

Since GMGridContainer uses the onResize action internally, the associated function has been replaced with a FunctionList. One should use addFunc to assign new actions to be performed when a GMGridContainer is resized.

Class Methods

.new

Creates a new instance of GMGridContainer.

Returns:

a GMGridContainer instance.

Instance Methods

.insertView

Insert a new view inside this class layout. Every child view will be rearranged automatically into an even spaced grid.

.removeView

Remove a view from the internal view list. The view needs either needs to be destroyed, or reassigned a new parent in order to disappear from the GMGridContainer.

.orientation

Sets or gets the orientation of the grid. Can be either \horizontal or \vertical.abs

.margins

Sets or gets the margin value between each views, in pixels.

Internal methods

.prArrangeViews

.prGetGridOrga