-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Active TabBar
is not highlighted initially
#18
Comments
I'm pretty new to rust, but i think this is to do with how the buttons are added to the TabBar of the TabPanel. The TabBar isn't public so i can't see how to set the active button easily, but i have a work around below. Problem: Lines 121 to 138 in 52e94cb
Adding a tab using the "add_tab_at" method with an index (pos) sets the active TabBarButton to that index. Lines 189 to 205 in 52e94cb
Workaround: Add the desired active tab after you've added the other tabs. This will set it's TabBar Button to be active. Of course you'll need the "add_tab_at" method so the panel will need to be mutable. let mut panel = TabPanel::new().with_tab(TextView::new(TAB_1).with_name("1"))
.with_tab(TextView::new(TAB_2).with_name("2"))
.with_tab(TextView::new(TAB_3).with_name("3"))
.with_tab(PaddedView::lrtb(2, 2, 1, 1, TextArea::new()).with_name("4"))
.with_bar_alignment(Align::End);
panel.add_tab_at(TextView::new(TAB_0).with_name("0"), 0);
panel.set_active_tab("0").unwrap_or_else(|_| {
panic!("Could not set the first tab as active tab! This is probably an issue with the implementation in the lib. Please report!");
}); |
How to focus on a tab panel's internal component, instead of one of the tabs? For example, I have a text editor, I hope to focus on it, instead of the containing tab panel. Thanks |
Hello, I'm following the example verbatim.
cursive-tabs/examples/fullscreen.rs
Lines 1 to 60 in 52e94cb
The active tab name is not highlighted initially even though active tab is being set.
cursive-tabs/examples/fullscreen.rs
Line 34 in 52e94cb
Image to illustrate potential bug and expected behavior.
Could be the same issue as #4
Package info:
cursive-tabs = "0.7.0"
The text was updated successfully, but these errors were encountered: