View is an interface for accessing an element of "View" type. View is a rectangular area of the screen.All interface elements extend the View interface, i.e. View is the base element for all other elements in the library.

View has a number of properties like height, width, color, text parameters, etc. Each property has a text name.The Properties interface is used to read and write the property value (View implements this interface):

type Properties interface {
	Get(tag string) any
	Set(tag string, value any) bool
	Remove(tag string)
	AllTags() []string

The Get function returns the value of the property, or nil if the property is not set.

The Set function sets the value of a property. If the property value is set successfully, thenthe function returns true, if not, then false and a description of the error that occurred is written to the log.

The Remove function removes property value, equivalent to Set(nil)

To simplify setting / reading properties, there are also two global functions Get and Set:

func Get(rootView View, viewID, tag string) any
func Set(rootView View, viewID, tag string, value any) bool

These functions get/set the value of the child View

Tracking property changes

You can set a function to track the change of absolutely any View property (there are no exceptions).To set up a change listener, the View interface contains a function:

SetChangeListener(tag string, listener func(View, string))

where the first parameter is the name of the tracked property, and the second is the functionthat will be called every time the property value changes.

For example

view.SetChangeListener(rui.BackgroundColor, listener func(view View, tag string) {
	// The background color changed