WebStackLayout

Package: Libraries.Web.Layouts · Inherits from: Libraries.Language.Object, Libraries.Web.Layouts.WebLayout

WebStackLayout places the items inside an element one under another, from top to bottom. The gap is the space between items, in pixels. By default, items stretch to the element's full width; they can instead be lined up on the left, in the center or on the right.

Example Code

use Libraries.Web.Page.all
use Libraries.Web.Layouts.WebStackLayout

class Main is WebPage
    action Main
        WebStackLayout stack
        stack:SetGap(8)
        stack:AlignCenter()

        Section section
        SetLayout(section, stack)
        section:AddParagraph("First")
        section:AddParagraph("Second")
        Add(section)
    end
end

Actions

AlignCenter()

Centers every item, at its own width.

Example

use Libraries.Web.Layouts.WebStackLayout

WebStackLayout stack
stack:AlignCenter()

AlignLeft()

Lines every item up on the left, at its own width.

Example

use Libraries.Web.Layouts.WebStackLayout

WebStackLayout stack
stack:AlignLeft()

AlignRight()

Lines every item up on the right, at its own width.

Example

use Libraries.Web.Layouts.WebStackLayout

WebStackLayout stack
stack:AlignRight()

Generate()

Returns the stylesheet declarations for this stack. WebSite calls this when it writes the stylesheet; people making pages don't.

Returns

text: The declarations for this stack.

GetGap()

Returns the space between items, in pixels.

Returns

number: The gap, in pixels.

Example

use Libraries.Web.Layouts.WebStackLayout

WebStackLayout stack
stack:SetGap(8)
output stack:GetGap()

IsAlignedCenter()

Centers every item, at its own width.

Returns

boolean

Example

use Libraries.Web.Layouts.WebStackLayout

WebStackLayout stack
stack:AlignCenter()

IsAlignedLeft()

Lines every item up on the right, at its own width.

Returns

boolean

Example

use Libraries.Web.Layouts.WebStackLayout

WebStackLayout stack
stack:AlignRight()

IsAlignedRight()

Lines every item up on the left, at its own width.

Returns

boolean

Example

use Libraries.Web.Layouts.WebStackLayout

WebStackLayout stack
stack:AlignLeft()

IsStretched()

Gathers the items in the middle of the stack, top to bottom, when the stack is taller than they need, as for a dialog in the middle of the window.

Returns

boolean

SetCenteredVertically(boolean value)

Gathers the items in the middle of the stack, top to bottom, when the stack is taller than they need, as for a dialog in the middle of the window.

Parameters

  • value boolean: True to center the items vertically.

SetGap(number pixels)

Sets the space between items, in pixels.

Parameters

  • pixels number: The space between items. It can't be negative.

Example

use Libraries.Web.Layouts.WebStackLayout

WebStackLayout stack
stack:SetGap(8)

Stretch()

Stretches every item to the full width of the element. This is the default.

Example

use Libraries.Web.Layouts.WebStackLayout

WebStackLayout stack
stack:Stretch()

Inherited Actions

3 actions from Libraries.Language.Object