rat_widget

Module choice

Source
Expand description

Choice/Select widget.

use rat_popup::Placement;
use rat_scrolled::Scroll;
use rat_widget::choice::{Choice, ChoiceState};

let (widget, popup) = Choice::new()
        .item("Carrots")
        .item("Potatoes")
        .item("Onions")
        .item("Peas")
        .item("Beans")
        .item("Tomatoes")
        .popup_block(Block::bordered())
        .popup_placement(Placement::AboveOrBelow)
        .popup_boundary(max_bounds)
        .into_widgets();
 widget.render(Rect::new(3,3,15,1), &mut buf, &mut cstate);

 // ... render other widgets

 popup.render(Rect::new(3,3,15,1), &mut buf, &mut cstate);

Structs§

Functions§

  • Handle all events. Text events are only processed if focus is true. Mouse events are processed if they are in range.
  • Handle only mouse-events.
  • Handle events for the popup. Call before other handlers to deal with intersections with other widgets.