Dialog gives focus to its content first

This commit is contained in:
Alexandre Bury 2015-05-26 17:10:47 -07:00
parent 97d97afa8d
commit 5407c53545

View File

@ -209,12 +209,14 @@ impl View for Dialog {
fn take_focus(&mut self) -> bool {
// TODO: add a direction to the focus. Meanwhile, takes button first.
if !self.buttons.is_empty() {
if self.content.take_focus() {
self.focus = Focus::Content;
true
} else if !self.buttons.is_empty() {
self.focus = Focus::Button(0);
true
} else {
self.focus = Focus::Content;
self.content.take_focus()
false
}
}