dabo Commit
Revision 5667
Date: 2010-02-08 14:30:13 -0800 (Mon, 08 Feb 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5667

Changed:
U   trunk/dabo/ui/uiwx/dGrid.py

Log:
Fixed some display issues when the grid has at least one column with 
Expand=True.

Noticed that the code for dGrid overrode the initEvents() method, which is 
supposed to be empty for use by developers when subclassing framework base 
classes. Change it to use the framework-level _initEvents() instead.



Diff:
Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2010-02-08 17:57:16 UTC (rev 5666)
+++ trunk/dabo/ui/uiwx/dGrid.py 2010-02-08 22:30:13 UTC (rev 5667)
@@ -1839,10 +1839,10 @@
                # Set the header props/events
                self.initHeader()
                # Make sure that the columns are sized properly
-               self._updateColumnWidths()
+               dabo.ui.callAfter(self._updateColumnWidths)
 
 
-       def initEvents(self):
+       def _initEvents(self):
                ## pkm: Don't do the grid_cell mouse events, because we handle 
it manually and it
                ##      would result in doubling up the events.
                #self.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, 
self.__onWxGridCellMouseLeftDoubleClick)
@@ -1881,6 +1881,7 @@
 #              self.bindEvent(dEvents.GridContextMenu, self._onContextMenu)
                self.bindEvent(dEvents.GridMouseRightClick, 
self._onGridMouseRightClick)
                self.bindEvent(dEvents.Resize, self._onGridResize)
+               super(dGrid, self)._initEvents()
 
 
        def initHeader(self):
@@ -2285,7 +2286,7 @@
 
 
        def _onGridResize(self, evt):
-               dabo.ui.callAfter(self._updateColumnWidths)
+               dabo.ui.callAfterInterval(50, self._updateColumnWidths)
 
 
        @dabo.ui.deadCheck
@@ -2301,7 +2302,8 @@
                # Add up the current widths
                wds = [col.Width for col in self.Columns]
                wd = reduce(lambda x, y: x+y, wds)
-               diff = self.Width - wd
+               # Subtract one extra pixel to avoid triggering the scroll bar.
+               diff = self.Width - wd - 1
                if not diff:
                        return
                adj = diff/ dynColCnt
@@ -3201,7 +3203,9 @@
                app = self.Application
                if app is not None:
                        col._persist("Width")
+               dabo.ui.callAfterInterval(50, self._updateColumnWidths)
 
+
        def _onGridHeaderMouseMove(self, evt):
                curMousePosition = evt.EventData["mousePosition"]
                headerIsDragging = self._headerDragging
@@ -4058,6 +4062,7 @@
                        self.fillGrid(True)
                        biz = self.getBizobj()
                        if biz:
+                               self.SelectRow(biz.RowNumber)
                                self.Form.bindEvent(dEvents.RowNumChanged, 
self.__onRowNumChanged)
                else:
                        self._properties["DataSource"] = val



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to