Scroll
Show a part of view with scrollbar.
| Module | require("gui") |
| Type | Class |
| Inherits | View |
The Scroll view can show an arbitrary content view inside it.
When the content is larger than the Scroll view, scrollbars will be
optionally showed. When the content view is smaller then the Scroll view,
the content view will be resized to the size of the Scroll view.
Class methods
create()
Create a new Scroll view.
Return
ScrollMethods
setContentView(view)
Set the content view.
Parameters
Viewview
getContentView()
Return the content view.
Return
ViewsetContentSize(size)
Set the size of content view.
Parameters
SizeFsize
getContentSize()
Return the size of content view.
Return
SizeFsetScrollPosition(horizon, vertical)
Scroll to the horizon and vertical position.
Parameters
NumberhorizonNumbervertical
getScrollPosition()
Return the horizon and vertical scroll position.
Return
[Number, Number]getMaximumScrollPosition()
Return the maximum horizon and vertical scroll position.
Return
[Number, Number]setOverlayScrollbar(overlay) macOS linux
Set whether to use overlay scrolling.
Parameters
Booleanoverlay
isOverlayScrollbar() macOS linux
Return whether overlay scrolling is used.
Return
BooleansetScrollbarPolicy(hpolicy, vpolicy)
Set the policy for displaying horizontal and vertical scrollbars.
Parameters
Scroll::Policyhpolicy - Policy for horizontal scrollbar.Scroll::Policyvpolicy - Policy for vertical scrollbar.
getScrollbarPolicy()
Return the display policy of horizontal and vertical scrollbars.
Return
[Scroll::Policy, Scroll::Policy]setScrollElasticity(helasticity, velasticity) macOS
Set horizontal and vertical scroll elasticity (bounce).
Parameters
Scroll::Elasticityhelasticity - Horizontal scroll elasticity.Scroll::Elasticityvelasticity - Vertical scroll elasticity.
getScrollElasticity() macOS
Return the horizontal and vertical scroll elasticity.
Return
[Scroll::Elasticity, Scroll::Elasticity]Events
onScroll(self)
Emitted when the content view is being scrolled.
Parameters
Scrollself