How to use Selector

Is there any tutorial on how to use Selector? Or can somebody show an example?

You might want to add a link so other's know what "Selector" is. Otherwise it's quite a generic term and people won't know how to help you.

Yep, good point:
A argument to that method is a Selector. No documentation on how to use it, no examples, nothing...

https://docs.rs/cursive/0.15.0/cursive/struct.Cursive.html#method.focus

There's some documentation for the Selector itself. It can wrap either a &str (in this case the search will be equal to searching by name), or the ViewPath, which is simply a sequence of indices.

@Cerberuser Thanks, I appreciate it, but the point is that there are no examples how to use it. Actual runnable examples...

I think there is no documentation for it because it's not really usable yet.
Although Selector is supposed to provide an abstract interface for selecting an element, only selecting by name works at the moment.

     s.call_on(
         &view::Selector::Id("text"),
         |view: &mut views::TextView| {
             view.set_content("Text #2");
         },
     );

See discussion here: https://github.com/gyscos/cursive/issues/32

Thanks

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.