[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r8712 - in trunk/gnue-forms/src: GFObjects uidrivers/wx26/widgets
From: |
reinhard |
Subject: |
[gnue] r8712 - in trunk/gnue-forms/src: GFObjects uidrivers/wx26/widgets |
Date: |
Thu, 5 Oct 2006 08:53:00 -0500 (CDT) |
Author: reinhard
Date: 2006-10-05 08:52:59 -0500 (Thu, 05 Oct 2006)
New Revision: 8712
Modified:
trunk/gnue-forms/src/GFObjects/GFBlock.py
trunk/gnue-forms/src/GFObjects/GFGrid.py
trunk/gnue-forms/src/uidrivers/wx26/widgets/grid.py
Log:
When number of rows is reduced in a grid by resizing it, keep the current
record active and scroll up if necessary.
Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py 2006-10-05 12:29:55 UTC (rev
8711)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py 2006-10-05 13:52:59 UTC (rev
8712)
@@ -349,6 +349,32 @@
# Event handlers for UI events (scrollbar or mouse wheel)
# ---------------------------------------------------------------------------
+ def _event_rows_changed (self, new_rows):
+ """
+ Notify the block that the number of rows displayed has changed.
+
+ If the number of rows has decreased and the current record would end up
+ outside the visible area, scroll the visible area to again include the
+ current record.
+ """
+
+ self._rows = new_rows
+
+ if self.__visibleStart + self._rows < self._currentRecord + 1:
+ new_visible_start = self._currentRecord - self._rows + 1
+ self.__switch_record (self.__visibleStart - new_visible_start)
+ # Now we must jump to the new current widget in the UI
+ entry = self._form._currentEntry
+ if getattr(entry, '_block', None) == self:
+ self._form.dispatchEvent('gotoENTRY', object=entry,
+ _form=self._form)
+ # We are still in editing mode, so we have to update the entry
+ # editor
+ if hasattr(entry, '_displayHandler'):
+ entry._displayHandler.generateRefreshEvent()
+
+ # ---------------------------------------------------------------------------
+
def _event_scroll_delta (self, adjustment):
"""
Scroll the given number of records.
@@ -359,7 +385,6 @@
self._event_scroll_to_record (self.__visibleStart + adjustment)
-
# ---------------------------------------------------------------------------
def _event_scroll_to_record (self, position):
Modified: trunk/gnue-forms/src/GFObjects/GFGrid.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFGrid.py 2006-10-05 12:29:55 UTC (rev
8711)
+++ trunk/gnue-forms/src/GFObjects/GFGrid.py 2006-10-05 13:52:59 UTC (rev
8712)
@@ -59,6 +59,7 @@
self._block = self.get_block()
self.__rows = int(getattr(self, "rows", 1))
self.walk(self.__rows_walker)
+ self._block._rows = self.__rows
# -------------------------------------------------------------------------
@@ -73,6 +74,7 @@
self.__rows = new_rows
self.walk(self.__rows_walker)
+ self._block._event_rows_changed(new_rows)
# -------------------------------------------------------------------------
Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/grid.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/grid.py 2006-10-05 12:29:55 UTC
(rev 8711)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/grid.py 2006-10-05 13:52:59 UTC
(rev 8712)
@@ -93,7 +93,6 @@
crec = block._currentRecord
recs = block._recordCount
- self.pg_size = self._gfObject.rows
block.register_scrollbar(self)
self.scroll.Bind(wx.EVT_SCROLL, self.__on_scroll)
@@ -279,13 +278,6 @@
self.__change_visibility(self.__visible-1, False)
self.__visible -= 1
- if self._uiDriver._uiFocusIndex > self.__visible - 1:
- focus = self._uiDriver._uiFocusWidget
- focus.lose_focus(self._uiDriver._uiFocusIndex)
-
- self._uiDriver._uiFocusIndex = self.__visible - 1
- focus.indexed_focus(self.__visible - 1)
-
self._uiForm.main_window.Layout()
@@ -297,8 +289,8 @@
"""
Adjust the thumb-position and the number of rows of the scrollbar
"""
- self.scroll.SetScrollbar(position, self.pg_size, count,
- self.pg_size-1, True)
+ self.scroll.SetScrollbar(position, self.__visible, count,
+ self.__visible-1, True)
# =============================================================================
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r8712 - in trunk/gnue-forms/src: GFObjects uidrivers/wx26/widgets,
reinhard <=