Class Widget.ScrollView

ScrollView Widget.

a container view which can scroll independently on two axis (X/Y).

Inherits from:
* Core.Widget

Usage:

     dUI = require 'dmc_ui'
     widget = dUI.newScrollView()

Properties

.bounceIsActive () set/get activate rebound action when hitting a scroll-limit.
.delegate () set/get delegate for item.
.fillColor () [style] set/get Style value for Widget fill color.
.lowerHorizontalOffset () set/get the lower horizontal offset for the ScrollView.
.lowerVerticalOffset () set/get the lower vertical offset for the ScrollView.
.horizontalScrollEnabled () set/get control ScrollView horizontal motion.
.verticalScrollEnabled () set/get control ScrollView vertical motion.
.panGesture () get reference to pan gesture.
.pinchGesture () get reference to pinch gesture.
.scrollWidth () set/get width of scroll area.
.scrollHeight () set/get height of scroll area.
.upperHorizontalOffset () set/get the upper horizontal offset for the ScrollView.
.upperVerticalOffset () set/get the upper vertical offset for the ScrollView.

Methods

:getContentPosition () Returns the x and y coordinates of the ScrollView content.
:setContentPosition (params) Scroll to a specific x and/or y position.
:takeFocus (event) give touch focus to the ScrollView.

Class Constants

Widget.ScrollView.EVENT ScrollView event constant.


Properties

.bounceIsActive ()
set/get activate rebound action when hitting a scroll-limit. defaults to true.

Usage:

  • widget.bounceIsActive = true
  • print( widget.bounceIsActive )
.delegate ()
set/get delegate for item.

Usage:

  • widget.delegate = <delegate object>
  • print( widget.delegate )
.fillColor ()
[style] set/get Style value for Widget fill color.

Usage:

  • style.fillColor = '#ff0000'
  • print( style.fillColor )
.lowerHorizontalOffset ()
set/get the lower horizontal offset for the ScrollView. value must be a number, can be negative or positive. defaults to zero.

Usage:

  • widget.lowerHorizontalOffset = 30
  • print( widget.lowerHorizontalOffset )
.lowerVerticalOffset ()
set/get the lower vertical offset for the ScrollView. value must be a number, can be negative or positive. defaults to zero.

Usage:

  • widget.lowerVerticalOffset = 30
  • print( widget.lowerVerticalOffset )
.horizontalScrollEnabled ()
set/get control ScrollView horizontal motion. setting to false will disable scrolling in X-axis.

Usage:

  • widget.horizontalScrollEnabled = true
  • print( widget.horizontalScrollEnabled )
.verticalScrollEnabled ()
set/get control ScrollView vertical motion. setting to false will disable scrolling in Y-axis.

Usage:

  • widget.verticalScrollEnabled = true
  • print( widget.verticalScrollEnabled )
.panGesture ()
get reference to pan gesture. read-only

Usage:

    print( widget.panGesture )
.pinchGesture ()
get reference to pinch gesture. read-only

Usage:

    print( widget.pinchGesture )
.scrollWidth ()
set/get width of scroll area. this is the total scroll area, not just the scroll view port. value must be greater than zero.

Usage:

  • widget.scrollWidth = 1000
  • print( widget.scrollWidth )
.scrollHeight ()
set/get height of scroll area. this is the total scroll area, not just the scroll view port. value must be greater than zero.

Usage:

  • widget.scrollHeight = 1000
  • print( widget.scrollHeight )
.upperHorizontalOffset ()
set/get the upper horizontal offset for the ScrollView. value must be a number, can be negative or positive. defaults to zero.

Usage:

  • widget.upperHorizontalOffset = 30
  • print( widget.upperHorizontalOffset )
.upperVerticalOffset ()
set/get the upper vertical offset for the ScrollView. value must be a number, can be negative or positive. defaults to zero.

Usage:

  • widget.upperVerticalOffset = 30
  • print( widget.upperVerticalOffset )

Methods

:getContentPosition ()
Returns the x and y coordinates of the ScrollView content.

Returns:

  1. number x
  2. number y

Usage:

    local x, y = widget:getContentPosition()
:setContentPosition (params)
Scroll to a specific x and/or y position. Moves content position to x/y over a certain time duration. negative values are up and left, positive values are down and right.

Parameters:

  • params table of coordinates (Though x or y are optional, at least one of them must be specified)
    • x number x position (optional)
    • y number y position (optional)
    • time number duration of animation (default 500)
    • onComplete func function reference to call after animation (optional)
:takeFocus (event)
give touch focus to the ScrollView. the ScrollView will take the touch event and set the focus to itself. event must be from DMC TouchManager.

Parameters:

  • event Touch Event from DMC TouchManager

Usage:

    widget:takeFocus( event )

Class Constants

Widget.ScrollView.EVENT
ScrollView event constant. used when setting up event listeners.

Usage:

    widget:addEventListener( widget.EVENT, listener )
generated by LDoc 1.4.3 Last updated 2015-05-14 11:55:05