Skip to main content

Module select

Module select 

Source
Expand description

Selection by key, shared by the tree, the list and the table.

Experimental: may change in any release (docs/stability.md).

A selection holds keys, never row numbers: rows come and go, are sorted or moved, and what was selected stays selected. The cursor is the row the keyboard is on; the anchor is where a range (Shift) starts.

use egui_pop_views::select::{Mode, Selection};

let rows = [10, 20, 30, 40];
let mut s = Selection::<u32>::default();
s.apply(s.click(Mode::Multiple, rows.len(), &|i| rows[i], 1, egui::Modifiers::NONE));
s.apply(s.click(Mode::Multiple, rows.len(), &|i| rows[i], 3, egui::Modifiers::SHIFT));
assert_eq!(s.keys(), &[20, 30, 40]);
assert_eq!(s.cursor(), Some(&40));

Structs§

Proposal
A selection a gesture proposes, before its step runs.
Selection
The selected keys, the cursor and the anchor.

Enums§

Mode
How many rows may be selected.

Traits§

Key
What a view’s keys are: cloned, compared, hashed, and carried in step arguments as JSON.