focus

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package focus demonstrates a screen with multiple components sharing one keyboard, using pkg/focus to decide which of them has it.

A focus.Group holds the components in tab order and owns three things a hand-rolled index cannot do as well:

  • tab / shift-tab cycling, including the blur-everything-focus-one dance
  • granting focus to a component that was clicked, since the click arrives at the component rather than at the screen that knows the ordering
  • answering IsCapturingKeys from whichever component currently has focus

The screen still routes messages itself, because focus is about the keyboard and not about content: keys go to the focused component only — otherwise typing in the query would also drive the list's cursor — while mouse events go to every component, so each can test the click against its own rect and claim it if it landed inside.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(t theme.Theme) screen.Screen

New returns the focus demo's root screen.

Types

This section is empty.

Jump to

Keyboard shortcuts

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