module

Tryst::UI

A DSL for building tryst (Tk) apps - sugar over tryst, not a wall around it. Everything here compiles down to plain tryst calls, and every handle keeps an escape hatch back to the underlying Tryst::App.

Class methods

app(title : String | Nil = nil, scroll : Bool | Nil = nil, track_widgets : Bool = true, resizable : Bool | NamedTuple(width: Bool, height: Bool) | Nil = nil, geometry : String | Nil = nil, min_size : Tuple(Int32, Int32) | Nil = nil, max_size : Tuple(Int32, Int32) | Nil = nil, & : Session -> Nil) : Session

Build an app. Constructs a Session (Tk-free - no Tryst::App exists yet), yields it to the block, and returns that same session so .run/.run_async can be chained directly off the call. The underlying app is created lazily, at realize (see Session#realize).

track_widgets is Session's own stand-in for ruby's **app_opts (forwarded verbatim to Tryst::App.new there) - Crystal needs a fixed parameter list, and track_widgets is App.new's only other real keyword arg. resizable: false fixes the root window at its content's size (or {width: false, height: true} for per-axis control); geometry:/ min_size:/max_size: are the same options a ui.window takes, applied to the root window instead.

Source
app(title : String | Nil = nil, scroll : Bool | Nil = nil, track_widgets : Bool = true, resizable : Bool | NamedTuple(width: Bool, height: Bool) | Nil = nil, geometry : String | Nil = nil, min_size : Tuple(Int32, Int32) | Nil = nil, max_size : Tuple(Int32, Int32) | Nil = nil) : Session

ditto with no block, for a class that builds its own tree: Crystal never counts an instance variable assigned inside a block as initialized, so @session = Tryst::UI.app(...) followed by plain @session.button(...) statements is what lets a class hold its widgets in non-nilable fields. The Session IS the builder either way.

Source
auto_scroll

Whether a bare list/text_area/table/tree auto-attaches a scrollbar with no ui.scrollable wrapper needed - true by default. Three levels can override it, most specific wins: a widget's own scroll: option, then Tryst::UI.app's own scroll:, then this global default. Named to match ruby-tryst's own Tryst::UI.auto_scroll exactly (a plain attr_accessor there, not a predicate) rather than gaining a ? no ported caller expects.

Source
auto_scroll=(auto_scroll : Bool)

Whether a bare list/text_area/table/tree auto-attaches a scrollbar with no ui.scrollable wrapper needed - true by default. Three levels can override it, most specific wins: a widget's own scroll: option, then Tryst::UI.app's own scroll:, then this global default. Named to match ruby-tryst's own Tryst::UI.auto_scroll exactly (a plain attr_accessor there, not a predicate) rather than gaining a ? no ported caller expects.

Source
auto_scroll_canvas

The same default, but for canvas specifically - false by default, since a canvas is as often fixed drawing as scrollable content, unlike the other native types.

Source
auto_scroll_canvas=(auto_scroll_canvas : Bool)

The same default, but for canvas specifically - false by default, since a canvas is as often fixed drawing as scrollable content, unlike the other native types.

Source

Nested types