Scroll event

The "scroll-event" (ScrollEvent constant) is raised when the contents of the View are scrolled.The main event data listener has the following format:


func(View, Frame)

where the Frame elements contain the following data

  • Left - the new horizontal shift of the visible area (in pixels);
  • Top - the new vertical offset of the visible area (in pixels);
  • Width - the total width of the View in pixels;
  • Height - the total height of the View in pixels.

You can also use listeners in the following formats:

  • func(Frame)
  • func(View)
  • func()

You can get a list of listeners for this event using the function:

func GetScrollListeners(view View) []func(View, Frame)

The current position of the viewable area and the overall dimensions of the View can be obtained using the View interface function:

Scroll() Frame

or global function

func GetViewScroll(view View, subviewID ...string) Frame

The following global functions can be used for manual scrolling

func ScrollViewTo(view View, subviewID string, x, y float64)
func ScrollViewToStart(view View, subviewID ...string)
func ScrollViewToEnd(view View, subviewID ...string)

which scroll the view, respectively, to the given position, start and end