tkbind

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package tkbind holds the MVVM binding adapters that are specific to the pixel toolkit (github.com/go-widgets/toolkit) — the widgets whose value/callback shape the generic mvvm adapters can't express, such as a two-handle range slider (a multi-argument OnChange). It is the ONLY MVVM package that imports toolkit; the core mvvm package stays backend-free.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindCardActive added in v0.3.0

func BindCardActive(sel *mvvm.Observable[int], c *toolkit.Container, card *toolkit.CardLayout, invalidate func()) (unbind func())

BindCardActive one-way-binds an Observable[int] to a CardLayout's Active index, re-arranging its container so the newly selected card becomes the visible one. Which card shows is a view-model concern (like an Ext card layout driven by a bound activeItem), so the binding is VM→view only. Returns an unbind that detaches the subscription.

func BindContainer added in v0.3.0

func BindContainer[T any](l *mvvm.ObservableList[T], c *toolkit.Container, factory func(T) toolkit.Item, invalidate func()) (unbind func())

BindContainer drives a toolkit.Container's children from an ObservableList: on every list change it rebuilds the container's items via factory (each element → a layout Item) and calls invalidate. This is the data-driven half of the Sencha-style container/layout model — the view's children follow the view model's collection. It mirrors mvvm.BindList's full-rebuild shape (the child count is view-scale) while producing widget Items rather than strings. Returns an unbind that detaches the list subscription.

func BindRange

func BindRange(low, high *mvvm.Observable[float64], rs *toolkit.RangeSlider, invalidate func()) (unbind func())

BindRange two-way-binds a RangeSlider's Low/High to a pair of observables. The slider fires OnChange(low, high) on every drag — a shape the generic single-value BindField can't take — so this adapter fans it out to both observables and pushes each back to the matching field. Loop-free: the field writes are silent and Observable.Set skips equal values. Returns an unbind that restores the prior OnChange and detaches both subscriptions.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL