Main Page | Packages | Class Tree | Index | Help

xp.controls

class ScrollTarget

Object
  |
  +--xp.controls.ScrollTarget


class ScrollTarget
extends Object

ScrollTarget
A proxy that implements the IScrollTarget interface.

Simplifies adding scroll support to a component by providing a proxy to implement the IScrollTarget interface required by the ScrollBar.
Additionally it provides a number of convenience methods to simplify the process of updating the ScrollBar
The ScrollTarget implements the interface for both a vertical and a horizontal ScrollBar simulataneously so one ScrollTarget instance can used with two ScrollBars.
The ScrollTarget scrolls virtual lines i.e. it is unaware whether the actual scroll properties are pixel or line based

The ScrollTarget requires only that the scrollOwner implement setScrollContentVPos(pos) and setScrollContentHPos(pos) or just a single updateScroll(ScrollTargetInstance) method.
Note: The IScrollTarget interface is the notional interface implemented by the TextField builtIn object to provide scroll support
There is no current IScrollTarget class as due to limitations in FMX7 the interface cannot be defined.


Author:
ProWin Computers Ltd. - Rob Edgar

Version:
3.0.0.000

See also:


Field Summary

public
bottomScroll: Number
The bottommost visible line in a scroll control.

public
hLine: Number
The horizontal line size

public
hPage: Number
The horizontal page size

public
hscrollbar: ScrollBar
END IScrollTarget interface END reference to the horizontal scrollbar

public
maxhscroll: Number
The maximum value of hscroll. Part of the IScrollTarget interface

public
maxscroll: Number
The maximum value of scroll

public
minhscroll: Number
The minimum value of hscroll.

public
minscroll: Number
The minimum value of scroll

public
vLine: Number
The vertical line size

public
vPage: Number
The vertical page size

public
vscrollbar: ScrollBar
reference to the vertical scrollbar

Property Summary

public
hPosition: Number (read, write)
Gets or sets the current horizontal scroll position

public
hscroll: Number (read, write)
Indicates the horizontal scroll value of the scrollable content.

public
scroll: Number (read, write)
Indicates the current scrolling position of the scrollable content.

public
vPosition: Number (read, write)
Gets or sets the current vertical scroll position

Constructor

public
ScrollTarget ( scrollOwner: MovieClip, vscrollbar: ScrollBar, hscrollbar: ScrollBar)
Create a new ScrollTarget instance

Method Summary

public
addHScrollBar ( parent: MovieClip, clazz, depth: Number, line: Number, page: Number )
Adds the horizontal ScrollBar

public
addListener ( lsnr ): Void
Registers an object to receive notification when the onChanged and onScroller event handlers are invoked.

public
addVScrollBar ( parent: MovieClip, clazz, depth: Number, line: Number, page: Number )
Adds the vertical ScrollBar

public
enableScrollBar ( v ): Void
Change enable state of scrollbars

public
incHPosition ( inc: Number )
Increments the ScroolBars current position

public
incVPosition ( inc: Number )
Increments the ScroolBars current position

public
keyScroll ( code: Number ): Boolean
Sets the vertical scroll position to its maximum

public
Left ( ): Void
Sets the horizontal scroll position up by one virtual line

public
LineDown ( ): Void
Sets the vertical scroll position down by one virtual line

public
LineUp ( ): Void
Sets the vertical scroll position up by one virtual line

public
onChanged ( src ): Void
Invoked when the scrollable content is changed.

public
onScroller ( src ): Void
Invoked when one of the scrollable content scroll properties changes.

public
removeListener ( lsnr ): Void
Removes a listener object

public
resetScrollBar ( ): Void
Reinitialze the scrollbars-usually called when new content is loaded

public
Right ( ): Void
Sets the horizontal scroll position down by one virtual line

public
scrollToEnd ( ): Void
Sets the vertical scroll position to its maximum

public
scrollToHome ( ): Void
Sets the vertical scroll position to its minimum

public
setLargeScroll ( vPage, hPage )
Sets the large(page) scroll value

public
setScrollProperties ( maxVPos: Number, maxHPos: Number, minVPos: Number, minHPos: Number, vPage: Number, hPage: Number ): Void
Update the scrollinfo for the vertical and horizontal ScrollBars simultaneously.

public
setSmallScroll ( vLine, hLine )
Sets the small(line) scroll value



Field Documentation

bottomScroll

public var bottomScroll: Number
The bottommost visible line in a scroll control.

An integer that indicates the bottommost line that is currently visible.
Think of the host control as a “window” onto a block of content.
The property scroll is the index of the topmost visible line in the window.
All the content between lines scroll and bottomScroll are currently visible in the control.
Part of the IScrollTarget interface

hLine

public var hLine: Number
The horizontal line size

The amount to scroll when the ScrollBar arrow is clicked.
Part of the IScrollTarget interface

hPage

public var hPage: Number
The horizontal page size

The amount to scroll when the ScrollBar track is clicked.
Part of the IScrollTarget interface

hscrollbar

public var hscrollbar: ScrollBar
END IScrollTarget interface END reference to the horizontal scrollbar

maxhscroll

public var maxhscroll: Number
The maximum value of hscroll. Part of the IScrollTarget interface

maxscroll

public var maxscroll: Number
The maximum value of scroll

Part of the IScrollTarget interface

minhscroll

public var minhscroll: Number
The minimum value of hscroll.

Part of the IScrollTarget interface

minscroll

public var minscroll: Number
The minimum value of scroll

Part of the IScrollTarget interface

vLine

public var vLine: Number
The vertical line size

The amount to scroll when the ScrollBar arrow is clicked.
Part of the IScrollTarget interface

vPage

public var vPage: Number
The vertical page size

The amount to scroll when the ScrollBar track is clicked.
Part of the IScrollTarget interface

vscrollbar

public var vscrollbar: ScrollBar
reference to the vertical scrollbar


Property Documentation

hPosition

public hPosition: Number (read, write)
Gets or sets the current horizontal scroll position

calls onScroller to update the ScrollBars

hscroll

public hscroll: Number (read, write)
Indicates the horizontal scroll value of the scrollable content.

Part of the IScrollTarget interface

scroll

public scroll: Number (read, write)
Indicates the current scrolling position of the scrollable content.

Part of the IScrollTarget interface

vPosition

public vPosition: Number (read, write)
Gets or sets the current vertical scroll position

calls onScroller to update the ScrollBars


Constructor Documentation

ScrollTarget

public function ScrollTarget(scrollOwner: MovieClip,
 vscrollbar: ScrollBar,
 hscrollbar: ScrollBar)
Create a new ScrollTarget instance

A reference to the vertical and horizontal scrollbars can be passed to the constructor but it is more common to use the addXScrollBar method and have the ScrollTarget create the scrollbars

Parameters:
scrollOwner
The component that owns or hosts the scrollbars
vscrollbar
Reference to the vertical scrollbar(optional)
hscrollbar
Reference to the vertical scrollbar(optional)

Method Documentation

addHScrollBar

public function addHScrollBar(parent: MovieClip,
 clazz,
 depth: Number,
 line: Number,
 page: Number)
Adds the horizontal ScrollBar

Creates a ScrollBar instance in the scrollOwner control, initializes it and calls setScrollTarget

Parameters:
parent
The _parent MovieClip
clazz
The class of ScrollBar (usually ScrollBar)
depth
The depth to create the ScrollBar at
line
The smallScroll value
page
The largeScroll value
Returns:
A reference to the ScrollBar

addListener

public function addListener(lsnr): Void
Registers an object to receive notification when the onChanged and onScroller event handlers are invoked.

Registers an object to receive notification when the onChanged and onScroller event handlers have been invoked.
When scrollable content changes or is scrolled, the onChanged and onScroller event handlers are invoked, followed by the onChanged and onScroller event handlers of any objects registered as listeners.
Multiple objects can be registered as listeners.
To remove a listener object from a text field, call removeListener().
A reference to the scrollable content instance is passed as a parameter to the onScroller and onChanged handlers by the event source.
You can capture this data by putting a parameter in the event handler method.
Part of the IScrollTarget interface

addVScrollBar

public function addVScrollBar(parent: MovieClip,
 clazz,
 depth: Number,
 line: Number,
 page: Number)
Adds the vertical ScrollBar

Creates a ScrollBar instance in the scrollOwner control, initializes it and calls setScrollTarget

Parameters:
parent
The _parent MovieClip
clazz
The class of ScrollBar (usually ScrollBar)
depth
The depth to create the ScrollBar at
line
The smallScroll value
page
The largeScroll value
Returns:
A reference to the ScrollBar

enableScrollBar

public function enableScrollBar(v): Void
Change enable state of scrollbars

incHPosition

public function incHPosition(inc: Number)
Increments the ScroolBars current position

calls onScroller to update the ScrollBars

Parameters:
inc
The amount to increment the current position by.

incVPosition

public function incVPosition(inc: Number)
Increments the ScroolBars current position

calls onScroller to update the ScrollBars

Parameters:
inc
The amount to increment the current position by.

keyScroll

public function keyScroll(code: Number): Boolean
Sets the vertical scroll position to its maximum

Parameters:
code
The key code pressed
Returns:
A value indicating whether the key code was handled or not

Left

public function Left(): Void
Sets the horizontal scroll position up by one virtual line

LineDown

public function LineDown(): Void
Sets the vertical scroll position down by one virtual line

LineUp

public function LineUp(): Void
Sets the vertical scroll position up by one virtual line

onChanged

public function onChanged(src): Void
Invoked when the scrollable content is changed.

Part of the IScrollTarget interface

onScroller

public function onScroller(src): Void
Invoked when one of the scrollable content scroll properties changes.

Part of the IScrollTarget interface

removeListener

public function removeListener(lsnr): Void
Removes a listener object

Parameters:
lsnr
The object that will no longer receive notifications from onChanged or onScroller.

resetScrollBar

public function resetScrollBar(): Void
Reinitialze the scrollbars-usually called when new content is loaded

Right

public function Right(): Void
Sets the horizontal scroll position down by one virtual line

scrollToEnd

public function scrollToEnd(): Void
Sets the vertical scroll position to its maximum

scrollToHome

public function scrollToHome(): Void
Sets the vertical scroll position to its minimum

setLargeScroll

public function setLargeScroll(vPage,
 hPage)
Sets the large(page) scroll value

setScrollProperties

public function setScrollProperties(maxVPos: Number,
 maxHPos: Number,
 minVPos: Number,
 minHPos: Number,
 vPage: Number,
 hPage: Number): Void
Update the scrollinfo for the vertical and horizontal ScrollBars simultaneously.

Update the fields of this instance and then invokes the onChanged method

Parameters:
maxVPos
Max scroll position of vertical ScrollBar
maxHPos
Max scroll position of horizontal ScrollBar
minVPos
Min scroll position of vertical ScrollBar
minHPos
Min scroll position of horizontal ScrollBar
vPage
The page size of the vertical ScrollBar(optional)
hPage
The page size of the horizontal ScrollBar(optional)

setSmallScroll

public function setSmallScroll(vLine,
 hLine)
Sets the small(line) scroll value


The documentation was generated from the following file:


Generated on 10/30/2005 9:34:02 PM by AS2Doc