Minor fixes for crashes under wxMotif when setting attributes before
the grid has been first painted.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5920
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void DrawGridCellArea( wxDC& dc );
void DrawCellBorder( wxDC& dc, const wxGridCellCoords& );
void DrawGridCellArea( wxDC& dc );
void DrawCellBorder( wxDC& dc, const wxGridCellCoords& );
- void DrawAllGridLines( wxDC& dc, const wxRegion & reg = wxRegion() );
+ void DrawAllGridLines( wxDC& dc, const wxRegion & reg );
void DrawCell( wxDC& dc, const wxGridCellCoords& );
void DrawCellBackground( wxDC& dc, const wxGridCellCoords& );
void DrawCellValue( wxDC& dc, const wxGridCellCoords& );
void DrawCell( wxDC& dc, const wxGridCellCoords& );
void DrawCellBackground( wxDC& dc, const wxGridCellCoords& );
void DrawCellValue( wxDC& dc, const wxGridCellCoords& );
protected:
bool m_created;
protected:
bool m_created;
wxGridWindow *m_gridWin;
wxGridRowLabelWindow *m_rowLabelWin;
wxGridWindow *m_gridWin;
wxGridRowLabelWindow *m_rowLabelWin;
+ m_created = FALSE; // set to TRUE by CreateGrid
+ m_displayed = FALSE; // set to TRUE by OnPaint
+
+ m_table = (wxGridTableBase *) NULL;
+ m_cellEditCtrl = (wxWindow *) NULL;
+
+ m_numRows = 0;
+ m_numCols = 0;
+ m_currentCellCoords = wxGridNoCellCoords;
+
int colLblH = WXGRID_DEFAULT_COL_LABEL_HEIGHT;
int rowLblW = WXGRID_DEFAULT_ROW_LABEL_WIDTH;
int colLblH = WXGRID_DEFAULT_COL_LABEL_HEIGHT;
int rowLblW = WXGRID_DEFAULT_ROW_LABEL_WIDTH;
void wxGrid::CalcDimensions()
{
void wxGrid::CalcDimensions()
{
+ // This avoids a crash in SetScrollbars
+ //
+ if ( !m_displayed ) return;
+
int cw, ch;
GetClientSize( &cw, &ch );
int cw, ch;
GetClientSize( &cw, &ch );
SetEditControlValue();
ShowCellEditControl();
}
SetEditControlValue();
ShowCellEditControl();
}
- wxClientDC dc( m_gridWin );
- PrepareDC( dc );
-
- if ( m_currentCellCoords != wxGridNoCellCoords )
+ if ( m_displayed &&
+ m_currentCellCoords != wxGridNoCellCoords )
{
HideCellEditControl();
SaveEditControlValue();
{
HideCellEditControl();
SaveEditControlValue();
m_currentCellCoords = coords;
SetEditControlValue();
m_currentCellCoords = coords;
SetEditControlValue();
- wxRect r( SelectionToDeviceRect() );
- ClearSelection();
- if ( !GetBatchCount() ) m_gridWin->Refresh( FALSE, &r );
+ ShowCellEditControl();
+
+ if ( IsSelection() )
+ {
+ wxRect r( SelectionToDeviceRect() );
+ ClearSelection();
+ if ( !GetBatchCount() ) m_gridWin->Refresh( FALSE, &r );
+ }