controls/CustomGrid.py
branch1.1 Korean release
changeset 1280 72a826dfcfbb
parent 1197 eb118ed5cbe0
child 1568 ad7c7df6cbeb
--- a/controls/CustomGrid.py	Wed Mar 13 12:34:55 2013 +0900
+++ b/controls/CustomGrid.py	Wed Jul 31 10:45:07 2013 +0900
@@ -93,7 +93,7 @@
             self.Table.InsertRow(new_row, self.DefaultValue.copy())
             self.Table.ResetView(self)
         if new_row is not None:
-            self.SetSelectedRow(new_row)
+            self.SetSelectedCell(new_row, col)
 
     def DeleteRow(self):
         self.CloseEditControl()
@@ -105,7 +105,8 @@
             else:
                 self.Table.RemoveRow(row)
                 self.Table.ResetView(self)
-            self.SetSelectedRow(min(row, self.Table.GetNumberRows() - 1))
+            if self.Table.GetNumberRows() > 0:
+                self.SetSelectedCell(min(row, self.Table.GetNumberRows() - 1), col)
 
     def MoveRow(self, row, move):
         self.CloseEditControl()
@@ -117,10 +118,9 @@
             if new_row != row:
                 self.Table.ResetView(self)
         if new_row != row:
-            self.SetSelectedRow(new_row)
+            self.SetSelectedCell(new_row, col)
     
-    def SetSelectedRow(self, row):
-        col = self.GetGridCursorCol()
+    def SetSelectedCell(self, row, col):
         self.SetGridCursor(row, col)
         self.MakeCellVisible(row, col)
         self.RefreshButtons()