Skip to main content

index_signal

Function index_signal 

Source
pub fn index_signal(
    selected: &Signal<Option<SegmentId>>,
    ids: &[SegmentId],
) -> Signal<usize>
Expand description

Derive a Switcher-compatible index from a keyed selection.

SegmentedControl is keyed precisely so that a contributed segment cannot silently re-point the selection, but Switcher is index-driven — this is the adapter between the two. Unknown or absent ids resolve to 0, matching Switcher’s own out-of-range behaviour.

Switcher::new(segmented_control::index_signal(&view, &[LIST, GRID, COLUMNS]))
    .child(list_pane)
    .child(grid_pane)
    .child(columns_pane)