Skip to content
Benedict Allen edited this page Nov 17, 2015 · 5 revisions

ScrollContainer Class

The ScrollContainer is an object that can add scrollbars to scroll its content if the content's size exceeds the boundaries of the ScrollContainer.

Extends Sheet

Style options

  • colour - The background colour.
  • horizontal-bar - The colour of the horizontal bar tray.
  • horizontal-bar.bar - The colour of the horizontal bar.
  • horizontal-bar.active - The colour of the horizontal bar when held.
  • vertical-bar - The colour of the vertical bar tray.
  • vertical-bar.bar - The colour of the vertical bar.
  • vertical-bar.active - The colour of the vertical bar when held.

Constructor

ScrollContainer( number x, number y, number width, number height, Sheet element )

ScrollContainer( number x, number y, number width, number height )

ScrollContainer( Sheet element )

Callbacks

Note, this element uses the onPreDraw(), onPostDraw(), and onMouseEvent() callbacks of Sheet.

Properties

scrollX

ScrollContainer.scrollX - number

The current horizontal offset.

scrollY

ScrollContainer.scrollY - number

The current vertical offset.

horizontalPadding

ScrollContainer.horizontalPadding - number

The padding on the right side of the content.

verticalPadding

ScrollContainer.verticalPadding - number

The padding on the bottom side of the content.

Methods

setScrollX

This method is chainable.

ScrollContainer self = ScrollContainer:setScrollX( number scroll )

Sets the horizontal offset. Note that a positive value increases the scrolling (moves to the right).

setScrollY

This method is chainable.

ScrollContainer self = ScrollContainer:setScrollY( number scroll )

Sets the vertical offset. Note that a positive value increases the scrolling (moves downward).

number width = ScrollContainer:getContentWidth()

Returns the total width of the content, taking padding into account.

number height = ScrollContainer:getContentHeight()

Returns the total height of the content, taking padding into account.

Clone this wiki locally