I have a CBCGPGridCtrl
with virtual rows enabled (EnableVirtualMode
).
No problem with data display.
On some event (right click from another window) I want to move the current visible part of the grid to a specific row.
I couldn't find any specific method to do that.
I tried a couple of different options:
1.
I saw that manually moving the scrollbar cause a change in the values of variable like: m_nFirstVisibleItem
, m_nLastVisibleItem
and m_nVertScrollOffset
, so I thought to replicate that using setScrollPos
.
m_grid.SetScrollRange(SB_VERT, 0, size());
//....
m_grid.SetScrollPos(SB_VERT, gotoPosition);
But nothing happened and those variables were not affected.
- The other idea I tried was to select the row I was interested in, with:
m_grid.SetCurSel(gotoPosition);
None of those worked.
What is the right way to achieve that?