2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
// Name: DBGrid.cpp
|
|
|
|
// Purpose: wxGrid sample
|
|
|
|
// Author: Mark Johnson
|
|
|
|
// Modified by: 19990929.mj10777 a reuseable DBGrid
|
|
|
|
// Created: 19990929
|
|
|
|
// Copyright: (c)
|
|
|
|
// Licence: wxWindows license
|
2000-01-31 08:20:36 -05:00
|
|
|
// RCS-ID: $Id$
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
//-- all #ifdefs that the whole Project needs. -------------------------------------------
|
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
// For compilers that support precompilation, includes "wx/wx.h".
|
|
|
|
#include "wx/wxprec.h"
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
#ifndef WX_PRECOMP
|
|
|
|
#include "wx/wx.h"
|
|
|
|
#endif
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
//-- all #includes that every .cpp needs --- 19990807.mj10777 ----------------
|
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
#include "std.h" // sorgsam Pflegen !
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
BEGIN_EVENT_TABLE(DBGrid, wxGrid)
|
2001-02-01 15:24:44 -05:00
|
|
|
EVT_MOTION (DBGrid::OnMouseMove)
|
|
|
|
// DBGrid
|
|
|
|
// ------------
|
|
|
|
EVT_GRID_CELL_CHANGE( DBGrid::OnCellChange )
|
|
|
|
EVT_GRID_CELL_LEFT_CLICK( DBGrid::OnCellLeftClick )
|
|
|
|
EVT_GRID_CELL_LEFT_DCLICK( DBGrid::OnCellLeftDClick )
|
|
|
|
EVT_GRID_CELL_RIGHT_CLICK( DBGrid::OnCellRightClick )
|
|
|
|
EVT_GRID_CELL_RIGHT_DCLICK( DBGrid::OnCellRightDClick )
|
|
|
|
// EVT_GRID_COL_SIZE( DBGrid::OnColSize )
|
|
|
|
// EVT_GRID_ROW_SIZE( DBGrid::OnRowSize )
|
|
|
|
EVT_GRID_EDITOR_SHOWN( DBGrid::OnEditorShown )
|
|
|
|
EVT_GRID_EDITOR_HIDDEN( DBGrid::OnEditorHidden )
|
|
|
|
EVT_GRID_LABEL_LEFT_CLICK( DBGrid::OnLabelLeftClick )
|
|
|
|
EVT_GRID_LABEL_LEFT_DCLICK( DBGrid::OnLabelLeftDClick )
|
|
|
|
EVT_GRID_LABEL_RIGHT_CLICK( DBGrid::OnLabelRightClick )
|
|
|
|
EVT_GRID_LABEL_RIGHT_DCLICK( DBGrid::OnLabelRightDClick )
|
|
|
|
EVT_GRID_RANGE_SELECT( DBGrid::OnRangeSelected )
|
|
|
|
EVT_GRID_ROW_SIZE( DBGrid::OnRowSize )
|
|
|
|
EVT_GRID_SELECT_CELL( DBGrid::OnSelectCell )
|
|
|
|
EVT_MENU(GRID_EDIT,DBGrid::OnModusEdit)
|
|
|
|
EVT_MENU(GRID_BROWSE,DBGrid::OnModusBrowse)
|
2000-02-12 09:11:17 -05:00
|
|
|
END_EVENT_TABLE()
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
// wxListCtrl(parent, id, pos, size, style)
|
|
|
|
// wxGrid(parent,-1,wxPoint( 0, 0 ), wxSize( 400, 300 ) );
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
// DBGrid
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
// DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size):
|
|
|
|
// wxGrid(parent, id, pos, size)
|
|
|
|
DBGrid::DBGrid(wxWindow *parent, const wxWindowID id,const wxPoint& pos,const wxSize& size, long style):
|
2001-02-01 15:24:44 -05:00
|
|
|
wxGrid(parent, id, pos, size, style)
|
2000-01-28 10:25:32 -05:00
|
|
|
{
|
2001-02-01 15:24:44 -05:00
|
|
|
b_EditModus = FALSE;
|
|
|
|
//---------------------------------------------------------------------------------------
|
2004-01-11 17:08:25 -05:00
|
|
|
popupMenu1 = new wxMenu(_T(""));
|
2001-02-01 15:24:44 -05:00
|
|
|
popupMenu1->Append(GRID_EDIT, _("Edit Modus"));
|
2004-01-11 17:08:25 -05:00
|
|
|
popupMenu2 = new wxMenu(_T(""));
|
2001-02-01 15:24:44 -05:00
|
|
|
popupMenu2->Append(GRID_BROWSE, _("Browse Modus"));
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
DBGrid::~DBGrid()
|
|
|
|
{
|
2001-02-01 15:24:44 -05:00
|
|
|
delete popupMenu1;
|
|
|
|
delete popupMenu2;
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
int DBGrid::OnTableView(wxString Table)
|
|
|
|
{
|
2001-02-01 15:24:44 -05:00
|
|
|
wxStopWatch sw;
|
|
|
|
//---------------------------------------------------------------------------------------
|
|
|
|
int i=0,x,y,z, ValidTable=0;
|
|
|
|
wxString Temp0;
|
|
|
|
wxBeginBusyCursor();
|
|
|
|
SetDefaultCellFont(* pDoc->ft_Doc);
|
|
|
|
//---------------------------------------------------------------------------------------
|
|
|
|
ct_BrowserDB = (db_Br+i_Which)->ct_BrowserDB; // Get the DSN Pointer
|
|
|
|
//---------------------------------------------------------------------------------------
|
|
|
|
if (ct_BrowserDB) // Valid pointer (!= NULL) ?
|
|
|
|
{ // Pointer is Valid, use the wxDatabase Information
|
|
|
|
for (x=0;x<ct_BrowserDB->numTables;x++) // go through the Tables
|
|
|
|
{
|
|
|
|
if (!wxStrcmp((ct_BrowserDB->pTableInf+x)->tableName,Table)) // is this our Table ?
|
|
|
|
{ // Yes, the Data of this Table shall be put into the Grid
|
|
|
|
ValidTable = x; // Save the Tablenumber
|
|
|
|
(db_Br+i_Which)->OnSelect(Table,FALSE); // Select * from "table"
|
|
|
|
// Set the local Pointer to the Column Information we are going to use
|
|
|
|
(db_Br+i_Which)->cl_BrowserDB = (ct_BrowserDB->pTableInf+x)->pColInf;
|
|
|
|
if ((ct_BrowserDB->pTableInf+x)->pColInf) // Valid pointer (!= NULL) ?
|
|
|
|
{ // Pointer is Valid, Column Informationen sind Vorhanden
|
|
|
|
i = (db_Br+i_Which)->i_Records; // How many Records are there
|
|
|
|
(db_Br+i_Which)->i_Which = ValidTable; // Still used ???? mj10777
|
|
|
|
if (i == 0) // If the Table is empty, then show one empty row
|
|
|
|
i++;
|
|
|
|
// wxLogMessage(_("\n-I-> DBGrid::OnTableView() : Vor CreateGrid"));
|
|
|
|
CreateGrid(i,(ct_BrowserDB->pTableInf+x)->numCols); // Records , Columns
|
|
|
|
for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++) // Loop through the Fields
|
|
|
|
{ // The Field / Column name is used here as Row Titel
|
|
|
|
SetColLabelValue(y,((ct_BrowserDB->pTableInf+x)->pColInf+y)->colName);
|
|
|
|
SetColSize(y,95);
|
|
|
|
} // for (y=0;y<(ct_BrowserDB->pTableInf+x)->numCols;y++)
|
|
|
|
SetColSize(((ct_BrowserDB->pTableInf+x)->numCols-1),120); // Make the last Column Wider
|
|
|
|
// The Grid has been created, now fill it
|
|
|
|
for (z=0;z<(db_Br+i_Which)->i_Records;z++) // Loop through the Records
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
Temp0.Printf(_T("%06d"),z+1); SetRowLabelValue(z,Temp0); // Set Row Lable Value
|
2001-02-01 15:24:44 -05:00
|
|
|
(db_Br+i_Which)->OnGetNext((ct_BrowserDB->pTableInf+ValidTable)->numCols,FALSE);
|
|
|
|
for (y=0;y<(ct_BrowserDB->pTableInf+ValidTable)->numCols;y++) // Loop through the Fields
|
|
|
|
{ // BrowserDB::OnGetNext Formats the field Value into tablename
|
|
|
|
SetCellValue(z, y,((db_Br+i_Which)->cl_BrowserDB+y)->tableName);
|
|
|
|
}
|
|
|
|
if (z % 50 == 0)
|
|
|
|
{
|
|
|
|
Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - Record %6d (from %d) has been read."),Table.c_str(),z,(db_Br+i_Which)->i_Records);
|
|
|
|
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
|
|
|
|
}
|
|
|
|
} // for (z=0;z<(db_Br+i_Which)->i_Records;z++)
|
|
|
|
Temp0.Printf(_("-I-> DBGrid::OnTableView(%s) - %6d Records have been read. - Time needed : %ld ms"),Table.c_str(),z,sw.Time());
|
|
|
|
wxLogMessage(Temp0);
|
|
|
|
pDoc->p_MainFrame->SetStatusText(Temp0, 0);
|
|
|
|
// The Grid has been filled, now leave
|
|
|
|
goto Weiter;
|
|
|
|
} // if ((ct_BrowserDB->pTableInf+x)->pColInf)
|
|
|
|
else
|
|
|
|
wxLogMessage(_("\n-E-> DBGrid::OnTableView() : Invalid Column Pointer : Failed"));
|
|
|
|
} // if ((ct_BrowserDB->pTableInf+x)->tableType == "TABLE")
|
|
|
|
} // for (x=0;x<ct_BrowserDB->numTables;x++)
|
|
|
|
} // if (ct_BrowserDB)
|
2000-02-10 10:36:10 -05:00
|
|
|
else
|
2001-02-01 15:24:44 -05:00
|
|
|
wxLogMessage(_("\n-E-> DBGrid::OnTableView() : Invalid DSN Pointer : Failed"));
|
|
|
|
//---------------------------------------------------------------------------------------
|
|
|
|
Weiter:
|
|
|
|
EnableEditing(b_EditModus); // Deactivate in-place Editing
|
|
|
|
wxEndBusyCursor();
|
|
|
|
//---------------------------------------------------------------------------------------
|
|
|
|
wxLogMessage(_("-I-> DBGrid::OnTableView() - End"));
|
|
|
|
return 0;
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-03-15 13:52:23 -05:00
|
|
|
void DBGrid::OnModusEdit(wxCommandEvent& event)
|
2000-01-28 10:25:32 -05:00
|
|
|
{
|
2001-02-01 15:24:44 -05:00
|
|
|
b_EditModus = TRUE; // Needed by PopupMenu
|
|
|
|
EnableEditing(b_EditModus); // Activate in-place Editing
|
|
|
|
UpdateDimensions(); // Redraw the Grid
|
|
|
|
// wxLogMessage(_("-I-> DBGrid::OnModusEdit() - End"));
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-03-15 13:52:23 -05:00
|
|
|
void DBGrid::OnModusBrowse(wxCommandEvent& event)
|
2000-01-28 10:25:32 -05:00
|
|
|
{
|
2001-02-01 15:24:44 -05:00
|
|
|
b_EditModus = FALSE; // Needed by PopupMenu
|
|
|
|
EnableEditing(b_EditModus); // Deactivate in-place Editing
|
|
|
|
UpdateDimensions(); // Redraw the Grid
|
|
|
|
// wxLogMessage(_("-I-> DBGrid::OnModusBrowse() - End"));
|
2000-02-25 07:01:38 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-25 07:01:38 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
void DBGrid::OnEditorShown( wxGridEvent& ev )
|
|
|
|
{
|
2001-02-01 15:24:44 -05:00
|
|
|
// wxLogMessage(_("-I-> DBGrid::OnEditorShown() - End"));
|
|
|
|
ev.Skip();
|
2000-02-25 07:01:38 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-25 07:01:38 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
void DBGrid::OnEditorHidden( wxGridEvent& ev )
|
|
|
|
{
|
2001-02-01 15:24:44 -05:00
|
|
|
// wxLogMessage(_("-I-> DBGrid::OnEditorHidden() - End"));
|
|
|
|
ev.Skip();
|
2000-02-25 07:01:38 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
2000-02-25 07:01:38 -05:00
|
|
|
void DBGrid::OnSelectCell( wxGridEvent& ev )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("");
|
|
|
|
logBuf << _T("Selected cell at row ") << ev.GetRow()
|
|
|
|
<< _T(" col ") << ev.GetCol();
|
|
|
|
wxLogMessage( _T("%s"), logBuf.c_str() );
|
2001-02-01 15:24:44 -05:00
|
|
|
// you must call Skip() if you want the default processing
|
|
|
|
// to occur in wxGrid
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnMouseMove(wxMouseEvent &event)
|
|
|
|
{
|
2001-02-01 15:24:44 -05:00
|
|
|
MousePos = event.GetPosition();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnLabelLeftClick( wxGridEvent& ev )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("DBGrid::OnLabelLeftClick : ");
|
2001-02-01 15:24:44 -05:00
|
|
|
if ( ev.GetRow() != -1 )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T("row label ") << ev.GetRow();
|
2001-02-01 15:24:44 -05:00
|
|
|
}
|
|
|
|
else if ( ev.GetCol() != -1 )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T("col label ") << ev.GetCol();
|
2001-02-01 15:24:44 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T("corner label");
|
2001-02-01 15:24:44 -05:00
|
|
|
}
|
|
|
|
if ( ev.ShiftDown() )
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T(" (shift down)");
|
2001-02-01 15:24:44 -05:00
|
|
|
|
|
|
|
// wxLogMessage( "%s", logBuf.c_str() );
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf += _T("\n");
|
2001-02-01 15:24:44 -05:00
|
|
|
wxLogMessage(logBuf.c_str());
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnLabelRightClick( wxGridEvent& ev )
|
|
|
|
{
|
2001-02-01 15:24:44 -05:00
|
|
|
//-------------------------------------------------------
|
|
|
|
if (b_EditModus)
|
|
|
|
PopupMenu(popupMenu2,MousePos.x,MousePos.y);
|
|
|
|
else
|
|
|
|
PopupMenu(popupMenu1,MousePos.x,MousePos.y);
|
|
|
|
//-------------------
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("DBGrid::OnLabelRightClick : ");
|
2001-02-01 15:24:44 -05:00
|
|
|
if ( ev.GetRow() != -1 )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T("row label ") << ev.GetRow();
|
2001-02-01 15:24:44 -05:00
|
|
|
}
|
|
|
|
else if ( ev.GetCol() != -1 )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T("col label ") << ev.GetCol();
|
2001-02-01 15:24:44 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T("corner label");
|
2001-02-01 15:24:44 -05:00
|
|
|
}
|
|
|
|
if ( ev.ShiftDown() )
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T(" (shift down)");
|
2001-02-01 15:24:44 -05:00
|
|
|
|
|
|
|
// wxLogMessage( "%s", logBuf.c_str() );
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf += _T("\n");
|
2001-02-01 15:24:44 -05:00
|
|
|
wxLogMessage(logBuf.c_str());
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnLabelLeftDClick( wxGridEvent& ev )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("DBGrid::OnLabelLeftDClick : ");
|
2001-02-01 15:24:44 -05:00
|
|
|
if ( ev.GetRow() != -1 )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T("row label ") << ev.GetRow();
|
2001-02-01 15:24:44 -05:00
|
|
|
}
|
|
|
|
else if ( ev.GetCol() != -1 )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T("col label ") << ev.GetCol();
|
2001-02-01 15:24:44 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T("corner label");
|
2001-02-01 15:24:44 -05:00
|
|
|
}
|
|
|
|
if ( ev.ShiftDown() )
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T(" (shift down)");
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2004-01-11 17:08:25 -05:00
|
|
|
// wxLogMessage( _T("%s"), logBuf.c_str() );
|
|
|
|
logBuf += _T("\n");
|
2001-02-01 15:24:44 -05:00
|
|
|
wxLogMessage(logBuf.c_str());
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnLabelRightDClick( wxGridEvent& ev )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("DBGrid::OnLabelRightDClick : ");
|
2001-02-01 15:24:44 -05:00
|
|
|
if ( ev.GetRow() != -1 )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T("row label ") << ev.GetRow();
|
2001-02-01 15:24:44 -05:00
|
|
|
}
|
|
|
|
else if ( ev.GetCol() != -1 )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T("col label ") << ev.GetCol();
|
2001-02-01 15:24:44 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T("corner label");
|
2001-02-01 15:24:44 -05:00
|
|
|
}
|
|
|
|
if ( ev.ShiftDown() )
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf << _T(" (shift down)");
|
2001-02-01 15:24:44 -05:00
|
|
|
// wxLogMessage( "%s", logBuf.c_str() );
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf += _T("\n");
|
2001-02-01 15:24:44 -05:00
|
|
|
wxLogMessage(logBuf.c_str());
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnCellLeftClick( wxGridEvent& ev )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("DBGrid::OnCellLeftClick : ");
|
|
|
|
logBuf << _T("Cell at row ") << ev.GetRow()
|
|
|
|
<< _T(" col ") << ev.GetCol();
|
2001-02-01 15:24:44 -05:00
|
|
|
// wxLogMessage( "%s", logBuf.c_str() );
|
|
|
|
// wxMessageBox(logBuf);
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf += _T("\n");
|
2001-02-01 15:24:44 -05:00
|
|
|
wxLogMessage(logBuf.c_str());
|
|
|
|
// you must call event skip if you want default grid processing
|
|
|
|
// (cell highlighting etc.)
|
|
|
|
//
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnCellRightClick( wxGridEvent& ev )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("DBGrid::OnCellRightClick : ");
|
|
|
|
logBuf << _T("Cell at row ") << ev.GetRow()
|
|
|
|
<< _T(" col ") << ev.GetCol();
|
2001-02-01 15:24:44 -05:00
|
|
|
// wxLogMessage( "%s", logBuf.c_str() );
|
|
|
|
// wxMessageBox(logBuf);
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf += _T("\n");
|
2001-02-01 15:24:44 -05:00
|
|
|
wxLogMessage(logBuf.c_str());
|
|
|
|
// you must call event skip if you want default grid processing
|
|
|
|
// (cell highlighting etc.)
|
|
|
|
//
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnCellLeftDClick( wxGridEvent& ev )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("DBGrid::OnCellLeftDClick : ");
|
|
|
|
logBuf << _T("Cell at row ") << ev.GetRow()
|
|
|
|
<< _T(" col ") << ev.GetCol();
|
2001-02-01 15:24:44 -05:00
|
|
|
// wxLogMessage( "%s", logBuf.c_str() );
|
|
|
|
// wxMessageBox(logBuf);
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf += _T("\n");
|
2001-02-01 15:24:44 -05:00
|
|
|
wxLogMessage(logBuf.c_str());
|
|
|
|
// you must call event skip if you want default grid processing
|
|
|
|
// (cell highlighting etc.)
|
|
|
|
//
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnCellRightDClick( wxGridEvent& ev )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("DBGrid::OnCellRightDClick : ");
|
|
|
|
logBuf << _T("Cell at row ") << ev.GetRow()
|
|
|
|
<< _T(" col ") << ev.GetCol();
|
2001-02-01 15:24:44 -05:00
|
|
|
// wxLogMessage( "%s", logBuf.c_str() );
|
|
|
|
// wxMessageBox(logBuf);
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf += _T("\n");
|
2001-02-01 15:24:44 -05:00
|
|
|
wxLogMessage(logBuf.c_str());
|
|
|
|
// you must call event skip if you want default grid processing
|
|
|
|
// (cell highlighting etc.)
|
|
|
|
//
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnCellChange( wxGridEvent& ev )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("DBGrid::OnCellChange : ");
|
|
|
|
logBuf << _T("Cell at row ") << ev.GetRow()
|
|
|
|
<< _T(" col ") << ev.GetCol();
|
2001-02-01 15:24:44 -05:00
|
|
|
// wxLogMessage( "%s", logBuf.c_str() );
|
|
|
|
// wxMessageBox(logBuf);
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf += _T("\n");
|
2001-02-01 15:24:44 -05:00
|
|
|
wxLogMessage(logBuf.c_str());
|
|
|
|
// you must call event skip if you want default grid processing
|
|
|
|
// (cell highlighting etc.)
|
|
|
|
//
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnRowSize( wxGridSizeEvent& ev )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("DBGrid::OnRowSize : ");
|
|
|
|
logBuf << _T("Resized row ") << ev.GetRowOrCol();
|
2001-02-01 15:24:44 -05:00
|
|
|
// wxLogMessage( "%s", logBuf.c_str() );
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf += _T("\n");
|
2001-02-01 15:24:44 -05:00
|
|
|
wxLogMessage(logBuf.c_str());
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnColSize( wxGridSizeEvent& ev )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("DBGrid::OnColSize : ");
|
|
|
|
logBuf << _T("Resized col ") << ev.GetRowOrCol();
|
2001-02-01 15:24:44 -05:00
|
|
|
// wxLogMessage( "%s", logBuf.c_str() );
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf += _T("\n");
|
2001-02-01 15:24:44 -05:00
|
|
|
wxLogMessage(logBuf.c_str());
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2001-02-01 15:24:44 -05:00
|
|
|
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|
2000-01-28 10:25:32 -05:00
|
|
|
void DBGrid::OnRangeSelected( wxGridRangeSelectEvent& ev )
|
|
|
|
{
|
2004-01-11 17:08:25 -05:00
|
|
|
logBuf = _T("DBGrid::OnRangeSelected : ");
|
|
|
|
logBuf << _T("Selected cells from row ") << ev.GetTopRow()
|
|
|
|
<< _T(" col ") << ev.GetLeftCol()
|
|
|
|
<< _T(" to row ") << ev.GetBottomRow()
|
|
|
|
<< _T(" col ") << ev.GetRightCol();
|
|
|
|
logBuf += _T("\n");
|
2001-02-01 15:24:44 -05:00
|
|
|
// wxLogMessage( "%s", logBuf.c_str() );
|
|
|
|
wxLogMessage(logBuf.c_str());
|
|
|
|
ev.Skip();
|
2000-01-28 10:25:32 -05:00
|
|
|
}
|
2000-02-12 09:11:17 -05:00
|
|
|
//----------------------------------------------------------------------------------------
|