Avoid a crash due to OnSize being called before initialisation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47330 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -4188,6 +4188,7 @@ bool wxGrid::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
Create();
|
Create();
|
||||||
SetInitialSize(size);
|
SetInitialSize(size);
|
||||||
|
CalcDimensions();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -4368,7 +4369,7 @@ bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership,
|
|||||||
// stop all processing
|
// stop all processing
|
||||||
m_created = false;
|
m_created = false;
|
||||||
|
|
||||||
if (m_table)
|
if (m_table)
|
||||||
{
|
{
|
||||||
m_table->SetView(0);
|
m_table->SetView(0);
|
||||||
if( m_ownTable )
|
if( m_ownTable )
|
||||||
@@ -4406,7 +4407,7 @@ bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership,
|
|||||||
// original one current cell and selection regions
|
// original one current cell and selection regions
|
||||||
// might be invalid,
|
// might be invalid,
|
||||||
m_selectingKeyboard = wxGridNoCellCoords;
|
m_selectingKeyboard = wxGridNoCellCoords;
|
||||||
m_currentCellCoords =
|
m_currentCellCoords =
|
||||||
wxGridCellCoords(wxMin(m_numRows, m_currentCellCoords.GetRow()),
|
wxGridCellCoords(wxMin(m_numRows, m_currentCellCoords.GetRow()),
|
||||||
wxMin(m_numCols, m_currentCellCoords.GetCol()));
|
wxMin(m_numCols, m_currentCellCoords.GetCol()));
|
||||||
if (m_selectingTopLeft.GetRow() >= m_numRows ||
|
if (m_selectingTopLeft.GetRow() >= m_numRows ||
|
||||||
@@ -5974,7 +5975,7 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
|
|||||||
m_winCapture->CaptureMouse();
|
m_winCapture->CaptureMouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_ROW )
|
else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_ROW )
|
||||||
{
|
{
|
||||||
@@ -6737,7 +6738,7 @@ int wxGrid::SendEvent( const wxEventType type,
|
|||||||
pos.y += GetColLabelSize();
|
pos.y += GetColLabelSize();
|
||||||
if ( mouseEv.GetEventObject() == GetGridColLabelWindow() )
|
if ( mouseEv.GetEventObject() == GetGridColLabelWindow() )
|
||||||
pos.x += GetRowLabelSize();
|
pos.x += GetRowLabelSize();
|
||||||
|
|
||||||
wxGridEvent gridEvt( GetId(),
|
wxGridEvent gridEvt( GetId(),
|
||||||
type,
|
type,
|
||||||
this,
|
this,
|
||||||
@@ -6905,8 +6906,11 @@ void wxGrid::Refresh(bool eraseb, const wxRect* rect)
|
|||||||
|
|
||||||
void wxGrid::OnSize( wxSizeEvent& WXUNUSED(event) )
|
void wxGrid::OnSize( wxSizeEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
// update our children window positions and scrollbars
|
if (m_targetWindow != this) // check whether initialisation has been done
|
||||||
CalcDimensions();
|
{
|
||||||
|
// update our children window positions and scrollbars
|
||||||
|
CalcDimensions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGrid::OnKeyDown( wxKeyEvent& event )
|
void wxGrid::OnKeyDown( wxKeyEvent& event )
|
||||||
@@ -6934,7 +6938,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
|
|||||||
else if (event.GetKeyCode() == WXK_LEFT)
|
else if (event.GetKeyCode() == WXK_LEFT)
|
||||||
event.m_keyCode = WXK_RIGHT;
|
event.m_keyCode = WXK_RIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try local handlers
|
// try local handlers
|
||||||
switch ( event.GetKeyCode() )
|
switch ( event.GetKeyCode() )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user