Search code examples
wxwidgets

wxGrid - RefreshBlock Undocumented Member Function


In order to refresh a part of the grid, i.e., when font or alignment changes, I was using the following approach:

wxRect rect1=CellToRect(TopLeft);
wxRect rect2=CellToRect(BottomRight);
wxRect r(rect1.GetTopLeft(), rect2.GetBottomRight());

RefreshRect(r);

This was refreshing only a part of the intended block and was not working correctly.

From the suggestions of intellisense I came across RefreshBlock function and it works correctly. I searched the docs and have not found any information on it. I wonder if it is not recommended to use RefreshBlock for some reason? What does RefreshBlock do, does it refresh a block (as the name suggests) or is it equivalent to Refresh?

I am using wxWidgets 3.2 on Win10.

Thanks in advance.


Solution

  • The function RefreshBlock() is indeed the best way to do what you want and it was only undocumented by mistake, i.e. we simply forgot to do it. I've added documentation for it only now, so it will only get included in 3.2.1, but you can still use it in your code, the function itself is available since 3.1.3.