equal
deleted
inserted
replaced
90 if getattr(self, "_AddRow", None) is not None: |
90 if getattr(self, "_AddRow", None) is not None: |
91 new_row = self._AddRow(new_row) |
91 new_row = self._AddRow(new_row) |
92 else: |
92 else: |
93 self.Table.InsertRow(new_row, self.DefaultValue.copy()) |
93 self.Table.InsertRow(new_row, self.DefaultValue.copy()) |
94 self.Table.ResetView(self) |
94 self.Table.ResetView(self) |
95 self.SetGridCursor(new_row, col) |
95 if new_row is not None: |
96 self.MakeCellVisible(new_row, col) |
96 self.SetSelectedRow(new_row) |
97 self.RefreshButtons() |
|
98 |
97 |
99 def DeleteRow(self): |
98 def DeleteRow(self): |
100 self.CloseEditControl() |
99 self.CloseEditControl() |
101 row = self.GetGridCursorRow() |
100 row = self.GetGridCursorRow() |
102 if row >= 0: |
101 if row >= 0: |
104 if getattr(self, "_DeleteRow", None) is not None: |
103 if getattr(self, "_DeleteRow", None) is not None: |
105 self._DeleteRow(row) |
104 self._DeleteRow(row) |
106 else: |
105 else: |
107 self.Table.RemoveRow(row) |
106 self.Table.RemoveRow(row) |
108 self.Table.ResetView(self) |
107 self.Table.ResetView(self) |
109 new_row = min(row, self.Table.GetNumberRows() - 1) |
108 self.SetSelectedRow(min(row, self.Table.GetNumberRows() - 1)) |
110 self.SetGridCursor(new_row, col) |
|
111 self.MakeCellVisible(new_row, col) |
|
112 self.RefreshButtons() |
|
113 |
109 |
114 def MoveRow(self, row, move): |
110 def MoveRow(self, row, move): |
115 self.CloseEditControl() |
111 self.CloseEditControl() |
116 col = self.GetGridCursorCol() |
112 col = self.GetGridCursorCol() |
117 if getattr(self, "_MoveRow", None) is not None: |
113 if getattr(self, "_MoveRow", None) is not None: |
119 else: |
115 else: |
120 new_row = self.Table.MoveRow(row, move) |
116 new_row = self.Table.MoveRow(row, move) |
121 if new_row != row: |
117 if new_row != row: |
122 self.Table.ResetView(self) |
118 self.Table.ResetView(self) |
123 if new_row != row: |
119 if new_row != row: |
124 self.SetGridCursor(new_row, col) |
120 self.SetSelectedRow(new_row) |
125 self.MakeCellVisible(new_row, col) |
121 |
126 self.RefreshButtons() |
122 def SetSelectedRow(self, row): |
127 |
123 col = self.GetGridCursorCol() |
|
124 self.SetGridCursor(row, col) |
|
125 self.MakeCellVisible(row, col) |
|
126 self.RefreshButtons() |
|
127 |
128 def OnAddButton(self, event): |
128 def OnAddButton(self, event): |
129 self.AddRow() |
129 self.AddRow() |
130 self.SetFocus() |
130 self.SetFocus() |
131 event.Skip() |
131 event.Skip() |
132 |
132 |