diff --git a/uppsrc/DropGrid/DropGrid.cpp b/uppsrc/DropGrid/DropGrid.cpp index 0b31d1c71..eb86839ab 100644 --- a/uppsrc/DropGrid/DropGrid.cpp +++ b/uppsrc/DropGrid/DropGrid.cpp @@ -717,6 +717,18 @@ Value DropGrid::Get(int r, Id id) const return list.Get(r, id); } +Value DropGrid::GetPrev(int c) const +{ + int r = list.GetPrevCursor(); + return r >= 0 ? Get(r, c) : Null; +} + +Value DropGrid::GetPrev(Id id) const +{ + int r = list.GetPrevCursor(); + return r >= 0 ? Get(r, id) : Null; +} + void DropGrid::Set(int c, const Value& v) { list.Set(c, v); diff --git a/uppsrc/DropGrid/DropGrid.h b/uppsrc/DropGrid/DropGrid.h index aa7114772..bbe7a251e 100644 --- a/uppsrc/DropGrid/DropGrid.h +++ b/uppsrc/DropGrid/DropGrid.h @@ -179,6 +179,8 @@ class DropGrid : public Convert, public GridDisplay, public Ctrl Value Get(Id id) const; Value Get(int r, int c) const; Value Get(int r, Id id) const; + Value GetPrev(int c) const; + Value GetPrev(Id id) const; void Set(int c, const Value& v); void Set(Id id, const Value& v); void Set(int r, int c, const Value& v); diff --git a/uppsrc/GridCtrl/GridCtrl.cpp b/uppsrc/GridCtrl/GridCtrl.cpp index e3d885485..e960e72c6 100644 --- a/uppsrc/GridCtrl/GridCtrl.cpp +++ b/uppsrc/GridCtrl/GridCtrl.cpp @@ -2892,6 +2892,16 @@ Value GridCtrl::GetLast(int c) const return Get0(total_rows - 1, c + fixed_cols); } +Value GridCtrl::GetPrev(Id id) const +{ + return rowbkp[aliases.Get(id)]; +} + +Value GridCtrl::GetPrev(int c) const +{ + return rowbkp[c + fixed_cols]; +} + Value GridCtrl::GetNew(int c) const { return Get0(rowidx, c + fixed_cols); diff --git a/uppsrc/GridCtrl/GridCtrl.h b/uppsrc/GridCtrl/GridCtrl.h index e54a0faf4..813a06c98 100644 --- a/uppsrc/GridCtrl/GridCtrl.h +++ b/uppsrc/GridCtrl/GridCtrl.h @@ -1302,6 +1302,8 @@ class GridCtrl : public Ctrl Value GetNew(int c) const; Value GetFirst(int c) const; Value GetLast(int c) const; + Value GetPrev(Id id) const; + Value GetPrev(int c) const; Value& operator() (int r, int c); Value& operator() (int c); Value& operator() (Id id);