Index | Collapse All Expand All

SetMaxItemsPerLine Method
ListBox Class Members Examples See Also

Beta Documentation - Subject to change.
Sets the maximum number of items per line.

# Syntax

Lua
    function ListBox:SetMaxItemsPerLine(value);

#### Parameters

value
  Type: number
  The maximum number of elements per line.

# Remarks

Sets the maximum number of items to place in a single line, horizontally or vertically depending on the control's orientation, before advancing to the next line.

# Examples

This examples creates a listbox that lays out its elements from top to bottom but only allows at most 5 items per column.

Creating a Multi Column Listbox | Copy Code
--- | ---
            window = Turbine.UI.Lotro.Window();
            window:SetPosition( 200, 200 );
            window:SetSize( 200, 200 );
            window:SetText( "Test" );
            window:SetVisible( true );

            listbox = Turbine.UI.ListBox();
            listbox:SetParent( window );
            listbox:SetBackColor( Turbine.UI.Color( 0.2, 0.2, 0.2 ) );
            listbox:SetPosition( 30, 50 );
            listbox:SetSize( 140, 120 );
            listbox:SetMaxItemsPerLine( 5 );

            for i = 1, 30 do
              local listItem = Turbine.UI.Control();
              listItem:SetSize( 20, 20 );
              listItem:SetBackColor( Turbine.UI.Color( math.random(), math.random(), math.random() ) );
              listbox:AddItem( listItem );
            end

# See Also

- ListBox
- Turbine.UI