Author: reinhard
Date: 2010-12-02 14:47:47 -0600 (Thu, 02 Dec 2010)
New Revision: 10253

Modified:
   trunk/gnue-forms/
   trunk/gnue-forms/src/GFObjects/GFBlock.py
   trunk/gnue-forms/src/GFObjects/GFEntry.py
   trunk/gnue-forms/src/GFObjects/GFField.py
   trunk/gnue-forms/src/GFObjects/GFTabStop.py
   trunk/gnue-forms/src/uidrivers/wx/widgets/entry.py
Log:
Much improved behaviour of entries and grids when there is no current record.



Property changes on: trunk/gnue-forms
___________________________________________________________________
Name: bzr:revision-info
   - timestamp: 2010-12-02 19:02:14.151999950 +0100
committer: Reinhard Müller <reinhard.muel...@bytewise.at>
properties: 
        branch-nick: forms

   + timestamp: 2010-12-02 21:29:40.832000017 +0100
committer: Reinhard Müller <reinhard.muel...@bytewise.at>
properties: 
        branch-nick: forms

Name: bzr:file-ids
   - src/GFObjects/GFTabStop.py 
3...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFTabStop.py
src/uidrivers/qt3/widgets/entry.py      
8...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2Fuidrivers%2Fqt3%2Fwidgets%2Fentry.py
src/uidrivers/qt4/widgets/entry.py      
9...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2Fuidrivers%2Fqt4%2Fwidgets%2Fentry.py
src/uidrivers/wx/widgets/entry.py       
10...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2Fuidrivers%2Fwx%2Fwidgets%2Fentry.py

   + src/GFObjects/GFBlock.py   
1...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFBlock.py
src/GFObjects/GFEntry.py        
1...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFEntry.py
src/GFObjects/GFField.py        
1...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFField.py
src/GFObjects/GFTabStop.py      
3...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2FGFObjects%2FGFTabStop.py
src/uidrivers/wx/widgets/entry.py       
10...@3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:src%2Fuidrivers%2Fwx%2Fwidgets%2Fentry.py

Name: bzr:revision-id:v4
   - 3116 reinhard.muel...@bytewise.at-20100426083500-vtmq0qvd7htz02zx
3117 reinhard.muel...@bytewise.at-20100512151744-2jx8tmtop30kl5n0
3118 reinhard.muel...@bytewise.at-20100705094014-ks9yv7b8gs6ychrb
3119 reinhard.muel...@bytewise.at-20100706085143-hyxadj30ayg28jpx
3120 reinhard.muel...@bytewise.at-20100706140804-sn3npws1ykm81ubx
3121 reinhard.muel...@bytewise.at-20100909134008-5p7jq048nkutldse
3122 reinhard.muel...@bytewise.at-20100923144753-e8hthxho7n5mwg9z
3123 reinhard.muel...@bytewise.at-20100929193018-7r3injoy8g28fwm6
3124 reinhard.muel...@bytewise.at-20100930073631-ilf6smgjt6mfvkpz
3125 reinhard.muel...@bytewise.at-20101011191957-yaj9rkqbervc91ac
3126 reinhard.muel...@bytewise.at-20101020084039-jmfxjbctt6vc2usd
3127 reinhard.muel...@bytewise.at-20101020124425-0dpprxsmanmaenty
3128 reinhard.muel...@bytewise.at-20101020124541-zppkmzww1lnsk8x4
3129 reinhard.muel...@bytewise.at-20101020141905-vjg7r3wihnm7mxam
3130 reinhard.muel...@bytewise.at-20101020143045-pf9ywx1s3hdqbsh7
3131 reinhard.muel...@bytewise.at-20101020143328-ctfmr3fpp5quq1eo
3132 reinhard.muel...@bytewise.at-20101020152139-rlllh9m2qn45atcz
3133 reinhard.muel...@bytewise.at-20101020163022-tgnjcv18nzrc5sfw
3134 reinhard.muel...@bytewise.at-20101020165411-krluvclyw61ef9zp
3135 reinhard.muel...@bytewise.at-20101020185529-pmdkwkm59c1h630f
3136 reinhard.muel...@bytewise.at-20101020195954-1kd9avbmzkrzwzbt
3137 reinhard.muel...@bytewise.at-20101020202048-8q84nx5a54ifxkla
3138 reinhard.muel...@bytewise.at-20101027211256-o7pi879h2x1ceri2
3139 reinhard.muel...@bytewise.at-20101028135833-wftnu2r1cocknxyf
3140 reinhard.muel...@bytewise.at-20101028144709-dbamfa759xoeh127
3141 reinhard.muel...@bytewise.at-20101028145355-uhqftv7n1bcvuz8l
3142 reinhard.muel...@bytewise.at-20101028151042-ueeqwlufysjbke01
3143 reinhard.muel...@bytewise.at-20101028153459-522p7574jw2e11jj
3144 reinhard.muel...@bytewise.at-20101028164956-gua27xm7ad12a218
3145 reinhard.muel...@bytewise.at-20101028181046-hxaehghl84zx9ye0
3146 reinhard.muel...@bytewise.at-20101028194606-598w1lqua0te1m7j
3147 reinhard.muel...@bytewise.at-20101028205855-5k1f08wfdgofenjd
3148 reinhard.muel...@bytewise.at-20101102154340-basdvi9wrxzbx4va
3149 reinhard.muel...@bytewise.at-20101102155520-bbh74pv3qjur1epo
3150 reinhard.muel...@bytewise.at-20101112154024-57tv8mf0wbiycuw1
3151 reinhard.muel...@bytewise.at-20101112155954-ky2g6irsodlzg6yy
3152 reinhard.muel...@bytewise.at-20101114210345-8zsz8bdxtwjytkss
3153 reinhard.muel...@bytewise.at-20101114213813-m10tqf7r2elldh6l
3154 reinhard.muel...@bytewise.at-20101115202536-k0zrvggyt6jy8h0y
3155 reinhard.muel...@bytewise.at-20101122074637-ydmqkqy3udno2n5m
3156 reinhard.muel...@bytewise.at-20101122083336-1n0xys8y4ivtfzo4
3157 reinhard.muel...@bytewise.at-20101201210052-n8pz9fkj6z95zlo2
3158 reinhard.muel...@bytewise.at-20101202012351-kou0f0zchuws25al
3159 reinhard.muel...@bytewise.at-20101202125150-izgvlp3p35t6ny4q
3160 reinhard.muel...@bytewise.at-20101202145210-pf97mpvy5nvhkzqz
3161 reinhard.muel...@bytewise.at-20101202160021-cwhtwpidejk31t6w
3162 reinhard.muel...@bytewise.at-20101202174643-d9ydcs06o8kfy8h7
3163 reinhard.muel...@bytewise.at-20101202180214-zbmb7u0eec43z58g

   + 3116 reinhard.muel...@bytewise.at-20100426083500-vtmq0qvd7htz02zx
3117 reinhard.muel...@bytewise.at-20100512151744-2jx8tmtop30kl5n0
3118 reinhard.muel...@bytewise.at-20100705094014-ks9yv7b8gs6ychrb
3119 reinhard.muel...@bytewise.at-20100706085143-hyxadj30ayg28jpx
3120 reinhard.muel...@bytewise.at-20100706140804-sn3npws1ykm81ubx
3121 reinhard.muel...@bytewise.at-20100909134008-5p7jq048nkutldse
3122 reinhard.muel...@bytewise.at-20100923144753-e8hthxho7n5mwg9z
3123 reinhard.muel...@bytewise.at-20100929193018-7r3injoy8g28fwm6
3124 reinhard.muel...@bytewise.at-20100930073631-ilf6smgjt6mfvkpz
3125 reinhard.muel...@bytewise.at-20101011191957-yaj9rkqbervc91ac
3126 reinhard.muel...@bytewise.at-20101020084039-jmfxjbctt6vc2usd
3127 reinhard.muel...@bytewise.at-20101020124425-0dpprxsmanmaenty
3128 reinhard.muel...@bytewise.at-20101020124541-zppkmzww1lnsk8x4
3129 reinhard.muel...@bytewise.at-20101020141905-vjg7r3wihnm7mxam
3130 reinhard.muel...@bytewise.at-20101020143045-pf9ywx1s3hdqbsh7
3131 reinhard.muel...@bytewise.at-20101020143328-ctfmr3fpp5quq1eo
3132 reinhard.muel...@bytewise.at-20101020152139-rlllh9m2qn45atcz
3133 reinhard.muel...@bytewise.at-20101020163022-tgnjcv18nzrc5sfw
3134 reinhard.muel...@bytewise.at-20101020165411-krluvclyw61ef9zp
3135 reinhard.muel...@bytewise.at-20101020185529-pmdkwkm59c1h630f
3136 reinhard.muel...@bytewise.at-20101020195954-1kd9avbmzkrzwzbt
3137 reinhard.muel...@bytewise.at-20101020202048-8q84nx5a54ifxkla
3138 reinhard.muel...@bytewise.at-20101027211256-o7pi879h2x1ceri2
3139 reinhard.muel...@bytewise.at-20101028135833-wftnu2r1cocknxyf
3140 reinhard.muel...@bytewise.at-20101028144709-dbamfa759xoeh127
3141 reinhard.muel...@bytewise.at-20101028145355-uhqftv7n1bcvuz8l
3142 reinhard.muel...@bytewise.at-20101028151042-ueeqwlufysjbke01
3143 reinhard.muel...@bytewise.at-20101028153459-522p7574jw2e11jj
3144 reinhard.muel...@bytewise.at-20101028164956-gua27xm7ad12a218
3145 reinhard.muel...@bytewise.at-20101028181046-hxaehghl84zx9ye0
3146 reinhard.muel...@bytewise.at-20101028194606-598w1lqua0te1m7j
3147 reinhard.muel...@bytewise.at-20101028205855-5k1f08wfdgofenjd
3148 reinhard.muel...@bytewise.at-20101102154340-basdvi9wrxzbx4va
3149 reinhard.muel...@bytewise.at-20101102155520-bbh74pv3qjur1epo
3150 reinhard.muel...@bytewise.at-20101112154024-57tv8mf0wbiycuw1
3151 reinhard.muel...@bytewise.at-20101112155954-ky2g6irsodlzg6yy
3152 reinhard.muel...@bytewise.at-20101114210345-8zsz8bdxtwjytkss
3153 reinhard.muel...@bytewise.at-20101114213813-m10tqf7r2elldh6l
3154 reinhard.muel...@bytewise.at-20101115202536-k0zrvggyt6jy8h0y
3155 reinhard.muel...@bytewise.at-20101122074637-ydmqkqy3udno2n5m
3156 reinhard.muel...@bytewise.at-20101122083336-1n0xys8y4ivtfzo4
3157 reinhard.muel...@bytewise.at-20101201210052-n8pz9fkj6z95zlo2
3158 reinhard.muel...@bytewise.at-20101202012351-kou0f0zchuws25al
3159 reinhard.muel...@bytewise.at-20101202125150-izgvlp3p35t6ny4q
3160 reinhard.muel...@bytewise.at-20101202145210-pf97mpvy5nvhkzqz
3161 reinhard.muel...@bytewise.at-20101202160021-cwhtwpidejk31t6w
3162 reinhard.muel...@bytewise.at-20101202174643-d9ydcs06o8kfy8h7
3163 reinhard.muel...@bytewise.at-20101202180214-zbmb7u0eec43z58g
3164 reinhard.muel...@bytewise.at-20101202202940-kv3x2nnl7ljp8ywo

Name: bzr:text-parents
   - src/uidrivers/qt3/widgets/entry.py 
svn-v3-single1-dHJ1bmsvZ251ZS1mb3Jtcw..:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:10108
src/uidrivers/qt4/widgets/entry.py      
svn-v3-single1-dHJ1bmsvZ251ZS1mb3Jtcw..:3a364389-8fce-0310-8f11-cc363fde16c7:trunk%2Fgnue-forms:10108
src/uidrivers/wx/widgets/entry.py       
reinhard.muel...@bytewise.at-20101114213813-m10tqf7r2elldh6l

   + src/GFObjects/GFBlock.py   
reinhard.muel...@bytewise.at-20101202174643-d9ydcs06o8kfy8h7
src/GFObjects/GFEntry.py        
reinhard.muel...@bytewise.at-20101202174643-d9ydcs06o8kfy8h7
src/GFObjects/GFField.py        
reinhard.muel...@bytewise.at-20101202174643-d9ydcs06o8kfy8h7


Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py   2010-12-02 20:47:44 UTC (rev 
10252)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py   2010-12-02 20:47:47 UTC (rev 
10253)
@@ -943,9 +943,6 @@
             current record.
         """
 
-        if self._dataSourceLink.type == 'unbound':
-            return None
-
         if self.mode == 'query':
             return None
 
@@ -1531,21 +1528,20 @@
             newRecord = 0
             newRecordCount = 1
         elif self.__resultset is None:
-            newRecord = 0
+            newRecord = -1
             newRecordCount = 0
         else:
             newRecord = self.__resultset.getRecordNumber()
             newRecordCount = self.__resultset.getRecordCount()
 
-        adjustment = newRecord - self._currentRecord
-
         if new_visible_start is None:
             new_visible_start = self.__visible_start
         new_visible_start = max(new_visible_start, newRecord - self._rows + 1)
         new_visible_start = max(new_visible_start, 0)
         new_visible_start = min(new_visible_start, newRecord)
 
-        adjustment += self.__visible_start - new_visible_start
+        scroll = new_visible_start - self.__visible_start
+
         self.__visible_start = new_visible_start
 
         # Find out which ui entries to refresh
@@ -1566,7 +1562,7 @@
         # also contains the entries that are bound to us via grid_link.
         for field in self._fieldMap.itervalues():
             for entry in field._entryList:
-                entry.recalculate_visible(adjustment, self._currentRecord,
+                entry.recalculate_visible(scroll, self._currentRecord,
                         self.__record_count, refresh)
 
         self.__adjust_scrollbars()

Modified: trunk/gnue-forms/src/GFObjects/GFEntry.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFEntry.py   2010-12-02 20:47:44 UTC (rev 
10252)
+++ trunk/gnue-forms/src/GFObjects/GFEntry.py   2010-12-02 20:47:47 UTC (rev 
10253)
@@ -118,18 +118,22 @@
         if self.style == 'label':
             if not GFTabStop._is_enabled_(self, index):
                 return False
+
+            if self.visible_offset is None:
+                # No record displayed at all
+                return False
+
+            # Consider empty labels disabled. This makes a difference for
+            # the enclosing boxes.
+            if index is None:
+                record_number = None
             else:
-                # Consider empty labels disabled. This makes a difference for
-                # the enclosing boxes.
-                if index is None:
-                    record_number = None
-                else:
-                    record_number = self.visible_offset + index
-                return (self._field.get_value(record_number) is not None)
-        else:
-            return GFFieldBound._is_enabled_(self, index)
+                record_number = self.visible_offset + index
+            return (self._field.get_value(record_number) is not None)
 
+        return GFFieldBound._is_enabled_(self, index)
 
+
     # -------------------------------------------------------------------------
     # Refresh the user interface with the current field data
     # -------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/GFObjects/GFField.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFField.py   2010-12-02 20:47:44 UTC (rev 
10252)
+++ trunk/gnue-forms/src/GFObjects/GFField.py   2010-12-02 20:47:47 UTC (rev 
10253)
@@ -297,9 +297,12 @@
             if self.editable == 'N':
                 return False
 
-            new = (self._block.get_record_status(record_number) \
-                    in ['empty', 'inserted', 'void'])
+            status = self._block.get_record_status(record_number)
+            if status is None:
+                return False
 
+            new = status in ['empty', 'inserted', 'void']
+
             if self._block.editable == 'new' and not new:
                 return False
             if self.editable == 'new' and not new:

Modified: trunk/gnue-forms/src/GFObjects/GFTabStop.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFTabStop.py 2010-12-02 20:47:44 UTC (rev 
10252)
+++ trunk/gnue-forms/src/GFObjects/GFTabStop.py 2010-12-02 20:47:47 UTC (rev 
10253)
@@ -77,10 +77,9 @@
         self._rows = 1
         self._gap = 0
 
-        self.__visible_offset = 0
+        self.__visible_offset = None
         self.__visible_index = 0
-        self.__last_enabled_row = None
-        self.__current_row_enabled = True
+        self.__enabled_rows = None
 
 
     # -------------------------------------------------------------------------
@@ -114,7 +113,7 @@
         if self._block:
             self._block._entryList.append(self)
 
-        self.__last_enabled_row = self._rows - 1
+        self.__enabled_rows = self._rows
 
 
     # -------------------------------------------------------------------------
@@ -143,9 +142,14 @@
                 and index == self.__visible_index:
             return
 
-        self._form._event_focus_changed(self,
-                self.__visible_offset + index)
+        if self.__visible_offset is None:
+            # Click on a button which is bound to a block.
+            record_number = None
+        else:
+            record_number = self.__visible_offset + index
 
+        self._form._event_focus_changed(self, record_number)
+
     # -------------------------------------------------------------------------
 
     def _event_line_up(self):
@@ -244,6 +248,8 @@
         If this entry is part of a grid, this property contains the record
         number of the record visible in the first line. This is equal to the
         number of records which have scrolled out through the top of the grid.
+        If the grid is completely empty because the current block has no
+        records, this property contains None.
 
         If this entry is not part of a grid, this property simply contains the
         record number currently visible in the entry, or None if no record is
@@ -261,7 +267,8 @@
         current record is not visible in the grid (for example, because there
         is no current record set), this property holds None.
 
-        If this entry is not part of a grid, this property always contains 0.
+        If this entry is not part of a grid, this property always contains if
+        there is a current record, and None if there is no current record.
         """
         return self.__visible_index
 
@@ -269,7 +276,7 @@
     # Recalculate the visible index of an object
     # -------------------------------------------------------------------------
 
-    def recalculate_visible(self, adjustment, cur_record, rec_count, refresh):
+    def recalculate_visible(self, scroll, cur_record, rec_count, refresh):
         """
         Process a record pointer movement or a result set change for this
         entry.
@@ -279,7 +286,7 @@
         number of available records, and it redisplays the contents of the
         entry as needed.
 
-        @param adjustment: value to change the visible index, e.g. 1 or -1
+        @param scroll: How much records to scroll.
         @param cur_record: the currently active record, or -1 if there is no
             record active currently.
         @param rec_count: the number of records available at all
@@ -296,66 +303,67 @@
 
         if self._form.get_focus_object() is self:
             self.ui_focus_out()
+
         try:
             old_visible_index = self.__visible_index
 
-            index = min(max(self.__visible_index + adjustment, 0),
-                        int(self._rows)-1)
+            if cur_record == -1 and self._rows == 1:
+                # Single entry (no grid), no current record: no record
+                # displayed.
+                new_visible_offset = None
+            else:
+                # Display records, if the entry is in a grid even if there is
+                # no current record.
+                if self.__visible_offset is not None:
+                    new_visible_offset = self.__visible_offset + scroll
+                else:
+                    new_visible_offset = 0
 
-            # Don't let the index pass the number of records
-            lowestVisible = max(cur_record - index, 0)
-            if lowestVisible + index > rec_count:
-                index = index -1
+                new_visible_offset = min(new_visible_offset, rec_count - 
self._rows)
+                new_visible_offset = max(new_visible_offset, 0)
+                if cur_record != -1:
+                    new_visible_offset = max(new_visible_offset, cur_record - 
self._rows + 1)
+                    new_visible_offset = min(new_visible_offset, cur_record)
 
-            # If the current record has rolled around from the top to the
-            # bottom then reset the counter.
-            if cur_record == 0:
-                index = 0
+            if new_visible_offset != self.__visible_offset:
+                # If we have scrolled, redisplay all records
+                refresh = 'all'
 
-            self.__visible_index = index
+            self.__visible_offset = new_visible_offset
 
+            if cur_record == -1:
+                self.__visible_index = None
+            else:
+                self.__visible_index = cur_record - self.__visible_offset
+
             if self.uiWidget is not None:
-                if self.__last_enabled_row is None:
+                if self.__enabled_rows is None:
                     # if running for the first time, all rows are enabled
                     # because widgets are created enabled by default
-                    self.__last_enabled_row = self._rows - 1
+                    self.__enabled_rows = self._rows
 
-                # Re-enable old current row if it was disabled
-                if not self.__current_row_enabled:
-                    self.uiWidget._ui_set_enabled_(old_visible_index, True)
-                    self.__current_row_enabled = True
+                if self.__visible_offset is None:
+                    enabled_rows = 0
+                else:
+                    enabled_rows = rec_count - self.__visible_offset
+                    enabled_rows = min(enabled_rows, self._rows)
 
-                last_enabled_row = self.__visible_index + \
-                        (rec_count - cur_record) - 1
-                last_enabled_row = min(last_enabled_row, self._rows - 1)
-
                 # Disable rows if necessary
-                for i in range(last_enabled_row+1, self.__last_enabled_row+1):
+                for i in range(enabled_rows, self.__enabled_rows):
                     self.uiWidget._ui_set_enabled_(i, False)
 
                 # Enable rows if necessary
-                for i in range(self.__last_enabled_row+1, last_enabled_row+1):
-                    self.uiWidget._ui_set_enabled_(i, False)
+                for i in range(self.__enabled_rows, enabled_rows):
+                    self.uiWidget._ui_set_enabled_(i, True)
 
-                self.__last_enabled_row = last_enabled_row
+                self.__enabled_rows = enabled_rows
 
-                # Disable current row if current record is -1
-                if cur_record == -1:
-                    self.uiWidget._ui_set_enabled_(self.__visible_index, False)
-                    self.__current_row_enabled = False
-
-                first_visible_record = cur_record - self.__visible_index
-                if first_visible_record != self.__visible_offset:
-                    # If we have scrolled, redisplay all records
+                if refresh == 'all':
                     refresh_start = 0
-                    self.__visible_offset = first_visible_record
+                elif refresh == 'current':
+                    refresh_start = max(old_visible_index, 
self.__visible_index)
                 else:
-                    if refresh == 'all':
-                        refresh_start = 0
-                    elif refresh == 'current':
-                        refresh_start = max(old_visible_index, 
self.__visible_index)
-                    else:
-                        refresh_start = None
+                    refresh_start = None
 
                 if isinstance(self, GFFieldBound) and refresh_start is not 
None:
                     self.refresh_ui(refresh_start, self._rows - 1)
@@ -395,7 +403,7 @@
     def __update_status(self, refresh_start):
 
         if self.uiWidget is not None:
-            for index in range(refresh_start, self.__last_enabled_row + 1):
+            for index in range(refresh_start, self.__enabled_rows):
                 self.uiWidget._ui_set_enabled_(index, self._is_enabled_(index))
         self.getParent().update_status()
 
@@ -570,10 +578,7 @@
         record.
         """
 
-        if self.__current_row_enabled:
-            self.uiWidget._ui_set_current_row_(self.__visible_index)
-        else:
-            self.uiWidget._ui_set_current_row_(-1)
+        self.uiWidget._ui_set_current_row_(self.__visible_index)
 
 
 # =============================================================================
@@ -627,19 +632,23 @@
 
         if not GFTabStop._is_enabled_(self, index):
             return False
+
+        if self.visible_offset is None:
+            # No record displayed
+            return False
+
+        if index is None:
+            record_number = None
         else:
-            if index is None:
-                record_number = None
-            else:
-                record_number = self.visible_offset + index
-            return self._field.is_editable(record_number)
+            record_number = self.visible_offset + index
+        return self._field.is_editable(record_number)
 
 
     # -------------------------------------------------------------------------
     # UI events (called from UIEntry)
     # -------------------------------------------------------------------------
 
-    def _event_jump_records(self, index):
+    def _event_goto_record(self, index):
         """
         Move the database cursor as a result of the user clicking on a part of
         the grid which can't receive the focus.
@@ -725,7 +734,8 @@
 
     def refresh_ui_current(self):
 
-        self.refresh_ui(self.visible_index, self.visible_index)
+        if self.visible_index is not None:
+            self.refresh_ui(self.visible_index, self.visible_index)
 
 
     # -------------------------------------------------------------------------
@@ -748,14 +758,18 @@
 
         for index in range (from_index, to_index + 1):
             # Do not execute if we were editing - would overwrite unsaved 
change
-            if not (index == self.visible_index \
-                    and self._displayHandler.editing):
+            if (index == self.visible_index and self._displayHandler.editing):
+                continue
+
+            if self.visible_offset is not None:
                 try:
                     value = self._field.get_value(self.visible_offset + index)
                 except Exception:               # invalid value
                     value = None
-                display = self._displayHandler.build_display(value, False)
-                self.uiWidget._ui_set_value_(index, display)
+            else:
+                value = None
+            display = self._displayHandler.build_display(value, False)
+            self.uiWidget._ui_set_value_(index, display)
 
 
     # -------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/uidrivers/wx/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/widgets/entry.py  2010-12-02 20:47:44 UTC 
(rev 10252)
+++ trunk/gnue-forms/src/uidrivers/wx/widgets/entry.py  2010-12-02 20:47:47 UTC 
(rev 10253)
@@ -696,7 +696,7 @@
                 widget.GetParent().Refresh()    # Needed for Windows
 
             # Set new current row to specific color.
-            if index == -1:
+            if index is None:
                 self.__current_row = None
                 self.__current_row_color_save = None
             else:


_______________________________________________
commit-gnue mailing list
commit-gnue@gnu.org
http://lists.gnu.org/mailman/listinfo/commit-gnue

Reply via email to