Have child views take focus when added to StackView.

This commit is contained in:
Alexandre Bury 2015-05-24 01:22:27 -07:00
parent eb6af9b981
commit 5d9e8f760b
2 changed files with 3 additions and 1 deletions

View File

@ -199,6 +199,7 @@ impl Cursive {
/// It will wait for user input (key presses) and trigger callbacks accordingly.
/// Blocks until quit() is called.
pub fn run(&mut self) {
// And the big event loop begins!
while self.running {
// Do we need to redraw everytime?

View File

@ -26,7 +26,8 @@ impl StackView {
}
/// 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 {
view: Box::new(ShadowView::new(view)),
size: Vec2::new(0,0),