changeset 285:983c4279e08d

Only set focus in ListBox if rows are available
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 22 Apr 2013 10:53:59 +0200
parents 561441fde2ac
children 96843aedcf5e
files getan/view.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/getan/view.py	Tue Apr 16 11:51:35 2013 +0200
+++ b/getan/view.py	Mon Apr 22 10:53:59 2013 +0200
@@ -53,8 +53,14 @@
         self.frame.set_body(body)
 
     def set_focus(self, idx):
+        if not idx:
+            idx = 0
+
         self.frame.set_focus("body")
-        self.listbox.set_focus(idx)
+
+        if self.rows:
+            self.listbox.set_focus(idx)
+
         self._invalidate()
 
     def keypress(self, size, key):
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)