Moscrif.ScrollView Class
A Scroll View creates a scrollable part of content. The scroll view contains more views which can scroll vertically or horizontally.
Item Index
Methods
Properties
Methods
this
[name=null]
Create new ScrollView object.
Parameters:
-
[name=null]
String optionalName of object. Use null for unnamed control.
Returns:
Example:
var layout = new Moscrif.StackLayout();
layout.align = #start;
layout.pack = #start;
layout.orientation = #vert;
container = new Moscrif.ScrollView("container");
container.scrollMode = #vert;
container.dockContent = #top;
container.layout = layout;
…. left, top, width, height ….
app.add(container);
add
view
[order]
Function adds existing view object into ScrollView.
Parameters:
-
view
ViewView to add. View/ScrollView/TextView are supported.
-
[order]
Symbol optionalDefault is.
* #front * #back
Returns:
find
name
Search for child view, which name is same as name from function's param.
Parameters:
-
name
StringName of the child view to search
Returns:
Example:
var container = new Moscrif.ScrollView("container");
var itemA = new Moscrif.View("itemA");
container.add(itemA);
var itemB = new Moscrif.View("itemB");
container.add(itemB);
…...
// find view by name
var item = container.find("itemA");
// detach them
item.detach();
hasFocus
() Boolean
Returns true if ScrollView has focus. Otherwise, function returns false.
Returns:
invalidate
[left]
[top]
[right]
[bottom]
This function ensure redrawing a rectangle, determined by parameters. If no parameters are set, whole object will be redraw. Redrawing manages the function, which is set to onDraw event.
Parameters:
performLayout
() Window
Perform (force) layer calculation.
Returns:
removeAll
() chainable
Removes all views from the object.
resumeLayout
() Window
Resume layer's recalculating.
Returns:
Example:
list.native.suspendLayout();
for (var i = 0; i <100; i++) {
items[i] = new ListViewItem(null,null,i.toString());
list.add(items[i]);
}
list.native.resumeLayout();
scrollBy
dx
dy
Function scrolls elements by coordinates (dx and dy). However, this function scrolls only in adjusted set scroll mode (horizontal or vertical).
Returns:
scrollBy
x
y
Function scrolls elements to coordinates (x and y). However, this function scrolls only in adjusted set scroll mode (horizontal or vertical).
Returns:
suspendLayout
() Window
Pause layer's recalculating. This function is useful when a lot of items are inserted into view in short time. When resumeLayout is called, all items will be inserted at once .
Returns:
Example:
list.native.suspendLayout();
for (var i = 0; i <100; i++) {
items[i] = new ListViewItem(null,null,i.toString());
list.add(items[i]);
}
list.native.resumeLayout();
Properties
dockContent
Symbol
Dock Content:
- #left-top
- #top
- #right-top
- #right
- #right-bottom
- #bottom
- #left-bottom
- #left
scrollMode
Symbol
Scroll Mode:
- #horz
- #vert
- #both
- #none
stretch
Symbol
Gets or sets if the view's width is stretchable.
- #both
Events
onChar
This event is raised by release an UNICODE character key.
Event Payload:
-
sender
ObjectObject which caused this event.
-
key
IntegerCode from unicode table.
onDraw
This event occurs, when it is necessary to redraw object. onDraw event is usually managed by skin.
Event Payload:
-
sender
ObjectObject which caused this event.
-
canvas
CanvasCanvas object enabling drawing to the TextView.
onKeyPressed
This event is raised by press the key.
Event Payload:
-
sender
ObjectObject which caused this event.
-
key
SymbolPressed key.
- #leftSoftKey
- #rightSoftKey
- #home
- #back
- #send
- #end
- #num0 - #num9
- #star - the * key
- #hash - the # key
- #up
- #down
- #left
- #right
- #ok
- #volumeUp
- #volumeDown
- #power
- #camera
onKeyReleased
This event is raised by release the key.
Event Payload:
-
sender
ObjectObject which caused this event.
-
key
SymbolPressed key.
- #leftSoftKey
- #rightSoftKey
- #home
- #back
- #send
- #end
- #num0 - #num9
- #star - the * key
- #hash - the # key
- #up
- #down
- #left
- #right
- #ok
- #volumeUp
- #volumeDown
- #power
- #camera
onPointerDragged
Called when touch (click) is moved.
onPointerPressed
Called when touch (click) is stared.
onPointerReleased
Called when touch (click) is finished.
onProcess
Callback function, which is which is called from the object every 25ms.