Resize-event

The "resize-event" (ResizeEvent constant) is called when the View changes its position and/or size.The main event data listener has the following format:


func(View, Frame)

where the structure is declared as

type Frame struct {
	Left, Top, Width, Height float64
}

Frame elements contain the following data

  • Left - the new horizontal offset in pixels relative to the parent View (left position);
  • Top - the new vertical offset in pixels relative to the parent View (top position)
  • Width - the new width of the visible part of the View in pixels;
  • Height - the new height of the visible part 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 GetResizeListeners(view View, subviewID ...string) []func(View, Frame)

The current position and dimensions of the visible part of the View can be obtained using the View interface function:

Frame() Frame

or global function

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