Allow hiding/showing already hidden/shown wxGrid rows/columns.
Don't assert if an already hidden/shown row/column is being hidden/shown again but simply don't do anything. This is more convenient because the code outside wxGrid has no efficient way to only hide a row/column if it's currently shown. Closes #14960. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -8106,8 +8106,11 @@ int UpdateRowOrColSize(int& sizeCurrent, int sizeNew)
|
||||
// We're showing back a previously hidden row/column.
|
||||
wxASSERT_MSG( sizeNew == -1, wxS("New size must be positive or -1.") );
|
||||
|
||||
wxASSERT_MSG( sizeCurrent < 0, wxS("May only show back if hidden.") );
|
||||
// If it's already visible, simply do nothing.
|
||||
if ( sizeCurrent >= 0 )
|
||||
return 0;
|
||||
|
||||
// Otherwise show it by restoring its old size.
|
||||
sizeCurrent = -sizeCurrent;
|
||||
|
||||
// This is positive which is correct.
|
||||
@@ -8116,8 +8119,13 @@ int UpdateRowOrColSize(int& sizeCurrent, int sizeNew)
|
||||
else if ( sizeNew == 0 )
|
||||
{
|
||||
// We're hiding a row/column.
|
||||
wxASSERT_MSG( sizeCurrent > 0, wxS("Can't hide if already hidden.") );
|
||||
|
||||
// If it's already hidden, simply do nothing.
|
||||
if ( sizeCurrent <= 0 )
|
||||
return 0;
|
||||
|
||||
// Otherwise hide it and also remember the shown size to be able to
|
||||
// restore it later.
|
||||
sizeCurrent = -sizeCurrent;
|
||||
|
||||
// This is negative which is correct.
|
||||
|
Reference in New Issue
Block a user