Module pager

Module pager 

Source
๐Ÿ‘ŽDeprecated since 1.2.0: merged into form::Form
Expand description

Alternative to scrolling by page-breaking a layout.

If you have a lot of widgets to display, splitting them into pages is an alternative to scrolling.


    /// Single pager shows the widgets in one column, and
    /// can page through the list.
    let pager = SinglePager::new();
    let size = pager.layout_size(l2[1]);

    if !state.pager.valid_layout(size) {
          // GenericLayout is very basic.
          // Try LayoutForm or layout_edit() instead.
          let mut pl = GenericLayout::new();
          for i in 0..100 {
              pl.add(
                    state.check_states[i].focus.clone(), // widget-key
                    Rect::new(10, 10+i as u16, 15, 10), // widget area
                    None, // label text
                    Rect::default() // label area
              );
          }
          state.pager.set_layout(pl);
      }

      ///
      /// Use [SinglePager] or [DualPager] to calculate the page breaks.
      ///
      let mut pg_buf = pager
            .into_buffer(l2[1], &mut buf, &mut state.pager);

      ///
      /// Render your widgets with the help of [SinglePagerBuffer]/[DualPagerBuffer]
      ///
      for i in 0..100 {
          pg_buf.render(
              state.check_states[i].focus.clone(),
              || {
                Checkbox::new().text(format!("{:?}", i).to_string())
              },
              &mut state.check_states[i],
          );
      }

Structsยง

DualPagerDeprecated
This widget renders twp pages of a GenericLayout.
DualPagerBufferDeprecated
Renders directly to the frame buffer.
DualPagerStateDeprecated
Widget state.
FormDeprecated
A widget that helps with rendering a Form. Uses a GenericLayout for its layout information. Does no scrolling/paging whatsoever and any widgets out of view are simply not rendered.
FormBufferDeprecated
Renders directly to the frame buffer.
FormStateDeprecated
Widget state.
PageNavigationDeprecated
Render the navigation for one or more Pager widgets.
PageNavigationStateDeprecated
Widget state.
PagerDeprecated
Renders widgets for one page of a GenericLayout.
PagerBufferDeprecated
Rendering phase.
PagerStyleDeprecated
All styles for a pager.
SinglePagerDeprecated
This widget renders a single page of a GenericLayout.
SinglePagerBufferDeprecated
Renders directly to the frame buffer.
SinglePagerStateDeprecated
Widget state.