mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Have child views take focus when added to StackView.
This commit is contained in:
parent
eb6af9b981
commit
5d9e8f760b
@ -199,6 +199,7 @@ impl Cursive {
|
|||||||
/// It will wait for user input (key presses) and trigger callbacks accordingly.
|
/// It will wait for user input (key presses) and trigger callbacks accordingly.
|
||||||
/// Blocks until quit() is called.
|
/// Blocks until quit() is called.
|
||||||
pub fn run(&mut self) {
|
pub fn run(&mut self) {
|
||||||
|
|
||||||
// And the big event loop begins!
|
// And the big event loop begins!
|
||||||
while self.running {
|
while self.running {
|
||||||
// Do we need to redraw everytime?
|
// Do we need to redraw everytime?
|
||||||
|
@ -26,7 +26,8 @@ impl StackView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Add new view on top of the stack.
|
/// Add new view on top of the stack.
|
||||||
pub fn add_layer<T: 'static + View>(&mut self, view: T) {
|
pub fn add_layer<T: 'static + View>(&mut self, mut view: T) {
|
||||||
|
view.take_focus();
|
||||||
self.layers.push(Layer {
|
self.layers.push(Layer {
|
||||||
view: Box::new(ShadowView::new(view)),
|
view: Box::new(ShadowView::new(view)),
|
||||||
size: Vec2::new(0,0),
|
size: Vec2::new(0,0),
|
||||||
|
Loading…
Reference in New Issue
Block a user