#include "wx/colordlg.h"
#include "wx/grid.h"
+#include "wx/generic/gridctrl.h"
#include "griddemo.h"
grid->SetRowSize( 0, 60 );
grid->SetCellValue( 0, 0, "Ctrl+Home\nwill go to\nthis cell" );
- grid->SetCellValue( 0, 1, "Blah" );
+ grid->SetCellValue( 0, 1, "A long piece of text to demonstrate wrapping." );
+ grid->SetCellRenderer(0 , 1, new wxGridCellAutoWrapStringRenderer);
+ grid->SetCellEditor( 0, 1 , new wxGridCellAutoWrapStringEditor);
+
grid->SetCellValue( 0, 2, "Blah" );
grid->SetCellValue( 0, 3, "Read only" );
grid->SetReadOnly( 0, 3 );
if ( ev.ShiftDown() ) logBuf << " (shift down)";
if ( ev.ControlDown() ) logBuf << " (control down)";
- wxLogMessage( "%s", logBuf.c_str() );
+ wxLogMessage( wxT("%s"), logBuf.c_str() );
// you must call event skip if you want default grid processing
//
logBuf = "";
logBuf << "Left click at row " << ev.GetRow()
<< " col " << ev.GetCol();
- wxLogMessage( "%s", logBuf.c_str() );
+ wxLogMessage( wxT("%s"), logBuf.c_str() );
// you must call event skip if you want default grid processing
// (cell highlighting etc.)
{
logBuf = "";
logBuf << "Resized row " << ev.GetRowOrCol();
- wxLogMessage( "%s", logBuf.c_str() );
+ wxLogMessage( wxT("%s"), logBuf.c_str() );
ev.Skip();
}
{
logBuf = "";
logBuf << "Resized col " << ev.GetRowOrCol();
- wxLogMessage( "%s", logBuf.c_str() );
+ wxLogMessage( wxT("%s"), logBuf.c_str() );
ev.Skip();
}
<< ", ShiftDown: "<< (ev.ShiftDown() ? 'T':'F')
<< ", AltDown: "<< (ev.AltDown() ? 'T':'F')
<< ", MetaDown: "<< (ev.MetaDown() ? 'T':'F') << " )";
- wxLogMessage( "%s", logBuf.c_str() );
+ wxLogMessage( wxT("%s"), logBuf.c_str() );
// you must call Skip() if you want the default processing
// to occur in wxGrid
<< ", ShiftDown: "<< (ev.ShiftDown() ? 'T':'F')
<< ", AltDown: "<< (ev.AltDown() ? 'T':'F')
<< ", MetaDown: "<< (ev.MetaDown() ? 'T':'F') << " )";
- wxLogMessage( "%s", logBuf.c_str() );
+ wxLogMessage( wxT("%s"), logBuf.c_str() );
ev.Skip();
}
<< " row " << ev.GetRow()
<< " col " << ev.GetCol();
- wxLogMessage( "%s", logBuf.c_str() );
+ wxLogMessage( wxT("%s"), logBuf.c_str() );
ev.Skip();
}
void GridFrame::OnEditorShown( wxGridEvent& ev )
{
- wxLogMessage( "Cell editor shown." );
+ wxLogMessage( wxT("Cell editor shown.") );
ev.Skip();
}
void GridFrame::OnEditorHidden( wxGridEvent& ev )
{
- wxLogMessage( "Cell editor hidden." );
+ wxLogMessage( wxT("Cell editor hidden.") );
ev.Skip();
}
grid->SetMargins(0, 0);
grid->Fit();
- wxSize size = grid->GetSize();
- size.x += 10;
- size.y += 10;
- SetClientSize(size);
+ SetClientSize(grid->GetSize());
}