Closed matthiasbeyer closed 4 years ago
Hi Matthias, no at the moment it is not possible to define the location of tabs, they are just added incrementally but I'll look into this and add it for you.
As for the the vertical tab bar, this is a nice to have, and I would love to have this in. It requires a few moments but I can add it in the next few days.
Sounds awesome! Am really looking forward to it!
So I played around a bit, and added a new way to insert tabs. You can do this now with the help of add_tab_at
and with_tab_at
.
All that is required additionally is the postion you want to insert it at.
use cursive::views::TextView;
use cursive_tabs::TabPanel;
use cursive::align::HAlign;
fn main() {
let tabs = TabPanel::new()
.with_tab("Bar", TextView::new("Bar"))
.with_tab_at("Foo", TextView::new("Foo"), 0)
.with_bar_alignment(HAlign::Center);
}
You can also swap them now with swap_tabs
.
Documentation should be up in a moment or two. Included in 3f2d452f22087ff1c4265d1b59b9bce4a3a04e45.
Hope this helps to solve your problem, if not, or you have more ideas, I happily fix them :smile:
The vertical TabBar
is then included in the 0.3
release as I would like to set it via the set_bar_alignment
method but this currently only takes an HAlign
, so it will result in a breaking change.
Sounds really nice! I am looking forward to test the example! :smile:
Hey Matthias, finally got some time to finish all the things up that I wanted to change, I need to write some more tests but the feature itself is ready to use/try with commit d88b0544e7ca73301ae2265d24366e1e63c8d577.
Basically whats new is that you can now set the bar placement with set_bar_alignment
and with_bar_alignment
(chainable). Available options are HorizontalTop
, HorizontalBottom
, VerticalLeft
and VerticalRIght
.
I also updated the examples, to use each variant at least once.
Also the Alignment has changed a bit, instead of the cursive HAlign
, a general Align
is now in the lib which has the variants Start
, Center
and End
.
Just checkout the master branch when you want to try them out :D
Done that, I will put the next minor up tomorrow. I will close this issue for now and flag it with 0.3
Hi,
is it possible to define the location of the tab names? If not, consider this as a feature request.
Also: Would be nice to be able to actually have a vertical listing of tab names!
Awesome crate, please keep up the good work!