Reformatted source to normalize spacing/indentation - no code changes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7948 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
George Tasker
2000-08-05 18:34:44 +00:00
parent 3c8c835c23
commit 2941f53242
3 changed files with 164 additions and 173 deletions

View File

@@ -82,7 +82,8 @@ wxDb *READONLY_DB;
/* /*
* This function will return the exact string(s) from the database engine * This function will return the exact string(s) from the database engine
* indicating all error conditions which have just occured during the * indicating all error conditions which have just occured during the
* last call to the database engine. * last call to the database engine for the database connection pointed
* to by pDb.
* *
* This demo uses the returned string by displaying it in a wxMessageBox. The * This demo uses the returned string by displaying it in a wxMessageBox. The
* formatting therefore is not the greatest, but this is just a demo, not a * formatting therefore is not the greatest, but this is just a demo, not a
@@ -91,7 +92,7 @@ wxDb *READONLY_DB;
* NOTE: The value returned by this function is for temporary use only and * NOTE: The value returned by this function is for temporary use only and
* should be copied for long term use * should be copied for long term use
*/ */
const char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine) const char *GetExtendedDBErrorMsg(wxDb *pDb, char *ErrFile, int ErrLine)
{ {
static wxString msg; static wxString msg;
msg = ""; msg = "";
@@ -111,32 +112,23 @@ const char *GetExtendedDBErrorMsg(char *ErrFile, int ErrLine)
msg.Append ("\nODBC errors:\n"); msg.Append ("\nODBC errors:\n");
msg += "\n"; msg += "\n";
/* Scan through each database connection displaying // Display errors for this connection
* any ODBC errors that have occured. */ int i;
wxDbList *pDbList; for (i = 0; i < DB_MAX_ERROR_HISTORY; i++)
for (pDbList = PtrBegDbList; pDbList; pDbList = pDbList->PtrNext)
{ {
// Skip over any free connections if (pDb->errorList[i])
if (pDbList->Free)
continue;
// Display errors for this connection
int i;
for (i = 0; i < DB_MAX_ERROR_HISTORY; i++)
{ {
if (pDbList->PtrDb->errorList[i]) msg.Append(pDb->errorList[i]);
{ if (wxStrcmp(pDb->errorList[i],"") != 0)
msg.Append(pDbList->PtrDb->errorList[i]); msg.Append("\n");
if (wxStrcmp(pDbList->PtrDb->errorList[i],"") != 0) // Clear the errmsg buffer so the next error will not
msg.Append("\n"); // end up showing the previous error that have occurred
// Clear the errmsg buffer so the next error will not wxStrcpy(pDb->errorList[i],"");
// end up showing the previous error that have occurred
wxStrcpy(pDbList->PtrDb->errorList[i],"");
}
} }
} }
msg += "\n"; msg += "\n";
return /*(char*) (const char*) msg*/msg.c_str(); return msg.c_str();
} // GetExtendedDBErrorMsg } // GetExtendedDBErrorMsg
@@ -235,11 +227,11 @@ bool DatabaseDemoApp::OnInit()
// Show the frame // Show the frame
DemoFrame->Refresh(); DemoFrame->Refresh();
// DemoFrame->Show(TRUE);
return TRUE; return TRUE;
} // DatabaseDemoApp::OnInit() } // DatabaseDemoApp::OnInit()
BEGIN_EVENT_TABLE(DatabaseDemoFrame, wxFrame) BEGIN_EVENT_TABLE(DatabaseDemoFrame, wxFrame)
EVT_MENU(FILE_CREATE, DatabaseDemoFrame::OnCreate) EVT_MENU(FILE_CREATE, DatabaseDemoFrame::OnCreate)
EVT_MENU(FILE_RECREATE_TABLE, DatabaseDemoFrame::OnRecreateTable) EVT_MENU(FILE_RECREATE_TABLE, DatabaseDemoFrame::OnRecreateTable)
@@ -250,25 +242,29 @@ BEGIN_EVENT_TABLE(DatabaseDemoFrame, wxFrame)
EVT_CLOSE(DatabaseDemoFrame::OnCloseWindow) EVT_CLOSE(DatabaseDemoFrame::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
// DatabaseDemoFrame constructor // DatabaseDemoFrame constructor
DatabaseDemoFrame::DatabaseDemoFrame(wxFrame *frame, const wxString& title, DatabaseDemoFrame::DatabaseDemoFrame(wxFrame *frame, const wxString& title,
const wxPoint& pos, const wxSize& size): const wxPoint& pos, const wxSize& size):
wxFrame(frame, -1, title, pos, size) wxFrame(frame, -1, title, pos, size)
{ {
// Put any code in necessary for initializing the main frame here // Put any code in necessary for initializing the main frame here
pEditorDlg = NULL; pEditorDlg = NULL;
pParamDlg = NULL; pParamDlg = NULL;
} } // DatabaseDemoFrame constructor
void DatabaseDemoFrame::OnCreate(wxCommandEvent& event) void DatabaseDemoFrame::OnCreate(wxCommandEvent& event)
{ {
CreateDataTable(FALSE); CreateDataTable(FALSE);
} } // DatabaseDemoFrame::OnCreate()
void DatabaseDemoFrame::OnRecreateTable(wxCommandEvent& event) void DatabaseDemoFrame::OnRecreateTable(wxCommandEvent& event)
{ {
CreateDataTable(TRUE); CreateDataTable(TRUE);
} } // DatabaseDemoFrame::OnRecreate()
void DatabaseDemoFrame::OnRecreateIndexes(wxCommandEvent& event) void DatabaseDemoFrame::OnRecreateIndexes(wxCommandEvent& event)
{ {
@@ -288,18 +284,19 @@ void DatabaseDemoFrame::OnRecreateIndexes(wxCommandEvent& event)
wxEndBusyCursor(); wxEndBusyCursor();
wxString tStr; wxString tStr;
tStr = "Error creating CONTACTS indexes.\nNew indexes will be unavailable.\n\n"; tStr = "Error creating CONTACTS indexes.\nNew indexes will be unavailable.\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
} }
delete Contact; delete Contact;
Contact = NULL; Contact = NULL;
} } // DatabaseDemoFrame::OnRecreateIndexes()
void DatabaseDemoFrame::OnExit(wxCommandEvent& event) void DatabaseDemoFrame::OnExit(wxCommandEvent& event)
{ {
Close(); Close();
} } // DatabaseDemoFrame::OnExit()
void DatabaseDemoFrame::OnEditParameters(wxCommandEvent& event) void DatabaseDemoFrame::OnEditParameters(wxCommandEvent& event)
{ {
@@ -307,12 +304,14 @@ void DatabaseDemoFrame::OnEditParameters(wxCommandEvent& event)
BuildParameterDialog(this); BuildParameterDialog(this);
else else
wxMessageBox("Cannot change database parameters while creating or editing a record","Notice...",wxOK | wxICON_INFORMATION); wxMessageBox("Cannot change database parameters while creating or editing a record","Notice...",wxOK | wxICON_INFORMATION);
} } // DatabaseDemoFrame::OnEditParameters()
void DatabaseDemoFrame::OnAbout(wxCommandEvent& event) void DatabaseDemoFrame::OnAbout(wxCommandEvent& event)
{ {
wxMessageBox("wxWindows sample program for database classes\n\nContributed on 27 July 1998","About...",wxOK | wxICON_INFORMATION); wxMessageBox("wxWindows sample program for database classes\n\nContributed on 27 July 1998","About...",wxOK | wxICON_INFORMATION);
} } // DatabaseDemoFrame::OnAbout()
void DatabaseDemoFrame::OnCloseWindow(wxCloseEvent& event) void DatabaseDemoFrame::OnCloseWindow(wxCloseEvent& event)
{ {
@@ -369,18 +368,18 @@ void DatabaseDemoFrame::CreateDataTable(bool recreate)
wxEndBusyCursor(); wxEndBusyCursor();
wxString tStr; wxString tStr;
tStr = "Error creating CONTACTS table.\nTable was not created.\n\n"; tStr = "Error creating CONTACTS table.\nTable was not created.\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
success = FALSE; success = FALSE;
} }
else else
{ {
if (!Contact->CreateIndexes()) if (!Contact->CreateIndexes())
{ {
wxEndBusyCursor(); wxEndBusyCursor();
wxString tStr; wxString tStr;
tStr = "Error creating CONTACTS indexes.\nIndexes will be unavailable.\n\n"; tStr = "Error creating CONTACTS indexes.\nIndexes will be unavailable.\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
success = FALSE; success = FALSE;
} }
@@ -389,7 +388,7 @@ void DatabaseDemoFrame::CreateDataTable(bool recreate)
wxEndBusyCursor(); wxEndBusyCursor();
delete Contact; delete Contact;
Contact = NULL; Contact = NULL;
if (success) if (success)
wxMessageBox("Table and index(es) were successfully created.","Notice...",wxOK | wxICON_INFORMATION); wxMessageBox("Table and index(es) were successfully created.","Notice...",wxOK | wxICON_INFORMATION);
@@ -410,11 +409,12 @@ void DatabaseDemoFrame::BuildEditorDialog()
wxMessageBox("Unable to initialize the editor dialog for some reason","Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox("Unable to initialize the editor dialog for some reason","Error...",wxOK | wxICON_EXCLAMATION);
DemoFrame->Close(); DemoFrame->Close();
} }
} else }
{ else
wxMessageBox("Unable to create the editor dialog for some reason","Error...",wxOK | wxICON_EXCLAMATION); {
DemoFrame->Close(); wxMessageBox("Unable to create the editor dialog for some reason","Error...",wxOK | wxICON_EXCLAMATION);
} DemoFrame->Close();
}
} // DatabaseDemoFrame::BuildEditorDialog() } // DatabaseDemoFrame::BuildEditorDialog()
@@ -483,7 +483,7 @@ Ccontact::~Ccontact()
{ {
wxString tStr; wxString tStr;
tStr = "Unable to Free the Ccontact data table handle\n\n"; tStr = "Unable to Free the Ccontact data table handle\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
} }
} }
@@ -585,11 +585,11 @@ CeditorDlg::CeditorDlg(wxWindow *parent) : wxPanel (parent, 0, 0, 537, 480)
// uninitialized pointers from crashing the program // uninitialized pointers from crashing the program
widgetPtrsSet = FALSE; widgetPtrsSet = FALSE;
initialized = FALSE; initialized = FALSE;
Contact = NULL; Contact = NULL;
Show(FALSE); Show(FALSE);
} // CeditorDlg constructor } // CeditorDlg constructor
@@ -599,10 +599,10 @@ void CeditorDlg::OnCloseWindow(wxCloseEvent& event)
if ((mode != mCreate) && (mode != mEdit)) if ((mode != mCreate) && (mode != mEdit))
{ {
if (Contact) if (Contact)
{ {
delete Contact; delete Contact;
Contact = NULL; Contact = NULL;
} }
this->Destroy(); this->Destroy();
} }
else else
@@ -613,11 +613,11 @@ void CeditorDlg::OnCloseWindow(wxCloseEvent& event)
} // CeditorDlg::OnCloseWindow() } // CeditorDlg::OnCloseWindow()
void CeditorDlg::OnButton( wxCommandEvent &event ) void CeditorDlg::OnButton(wxCommandEvent &event)
{ {
wxWindow *win = (wxWindow*) event.GetEventObject(); wxWindow *win = (wxWindow*) event.GetEventObject();
OnCommand( *win, event ); OnCommand( *win, event );
} } // CeditorDlg::OnButton()
void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event) void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
@@ -741,7 +741,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
wxString tStr; wxString tStr;
tStr = "ODBC error during Query()\n\n"; tStr = "ODBC error during Query()\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
SetMode(mView); SetMode(mView);
return; return;
@@ -785,7 +785,6 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
// display it, if the query string has changed. // display it, if the query string has changed.
if (wxStrcmp(qryWhere, (const char*) Contact->qryWhereStr)) if (wxStrcmp(qryWhere, (const char*) Contact->qryWhereStr))
{ {
Contact->whereStr = ""; Contact->whereStr = "";
Contact->SetOrderByClause("NAME"); Contact->SetOrderByClause("NAME");
@@ -810,7 +809,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
wxString tStr; wxString tStr;
tStr = "ODBC error during Query()\n\n"; tStr = "ODBC error during Query()\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
return; return;
} }
@@ -845,7 +844,7 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
wxString tStr; wxString tStr;
tStr = "ODBC error during Query()\n\n"; tStr = "ODBC error during Query()\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
return; return;
} }
@@ -879,7 +878,6 @@ void CeditorDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
return; return;
} }
} // CeditorDlg::OnCommand() } // CeditorDlg::OnCommand()
@@ -902,7 +900,7 @@ bool CeditorDlg::Initialize()
{ {
wxString tStr; wxString tStr;
tStr.Printf("Unable to open the table '%s'.\n\nTable may need to be created...?\n\n",CONTACT_TABLE_NAME); tStr.Printf("Unable to open the table '%s'.\n\nTable may need to be created...?\n\n",CONTACT_TABLE_NAME);
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
bool createTable = (wxMessageBox("Do you wish to try to create/clear the CONTACTS table?","Confirm",wxYES_NO|wxICON_QUESTION) == wxYES); bool createTable = (wxMessageBox("Do you wish to try to create/clear the CONTACTS table?","Confirm",wxYES_NO|wxICON_QUESTION) == wxYES);
@@ -921,9 +919,8 @@ bool CeditorDlg::Initialize()
{ {
// Table does exist, or there was some problem opening it. Currently this should // Table does exist, or there was some problem opening it. Currently this should
// never fail, except in the case of the table not exisiting or the current // never fail, except in the case of the table not exisiting or the current
// user has insufficent privileges to access the table // user has insufficent privileges to access the table
#if 0 #if 0
// This code is experimenting with a new function that will hopefully be available // This code is experimenting with a new function that will hopefully be available
// in the 2.4 release. This check will determine whether the open failing was due // in the 2.4 release. This check will determine whether the open failing was due
// to the table not existing, or the users privileges being insufficient to // to the table not existing, or the users privileges being insufficient to
@@ -932,16 +929,16 @@ bool CeditorDlg::Initialize()
{ {
wxString tStr; wxString tStr;
tStr.Printf("Unable to open the table '%s'.\n\n",CONTACT_TABLE_NAME); tStr.Printf("Unable to open the table '%s'.\n\n",CONTACT_TABLE_NAME);
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
} }
else else
#endif #endif
if (Contact->GetDb()->TableExists(CONTACT_TABLE_NAME,Contact->GetDb()->GetUsername(),DbConnectInf.defaultDir)) if (Contact->GetDb()->TableExists(CONTACT_TABLE_NAME,Contact->GetDb()->GetUsername(),DbConnectInf.defaultDir))
{ {
wxString tStr; wxString tStr;
tStr.Printf("Unable to open the table '%s'.\n\n",CONTACT_TABLE_NAME); tStr.Printf("Unable to open the table '%s'.\n\n",CONTACT_TABLE_NAME);
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
} }
@@ -1034,7 +1031,7 @@ bool CeditorDlg::Initialize()
{ {
wxString tStr; wxString tStr;
tStr = "ODBC error during Query()\n\n"; tStr = "ODBC error during Query()\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
// GetParent()->Close(); // GetParent()->Close();
return FALSE; return FALSE;
@@ -1052,8 +1049,8 @@ bool CeditorDlg::Initialize()
Show(TRUE); Show(TRUE);
initialized = TRUE; initialized = TRUE;
return TRUE; return TRUE;
} // CeditorDlg::Initialize() } // CeditorDlg::Initialize()
@@ -1078,7 +1075,7 @@ void CeditorDlg::FieldsEditable()
void CeditorDlg::SetMode(enum DialogModes m) void CeditorDlg::SetMode(enum DialogModes m)
{ {
bool edit = FALSE; bool edit = FALSE;
mode = m; mode = m;
switch (mode) switch (mode)
@@ -1282,7 +1279,7 @@ bool CeditorDlg::Save()
{ {
wxString tStr; wxString tStr;
tStr = "A duplicate key value already exists in the table.\nUnable to save record\n\n"; tStr = "A duplicate key value already exists in the table.\nUnable to save record\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
} }
else else
@@ -1290,7 +1287,7 @@ bool CeditorDlg::Save()
// Some other unexpexted error occurred // Some other unexpexted error occurred
wxString tStr; wxString tStr;
tStr = "Database insert failed\n\n"; tStr = "Database insert failed\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
} }
} }
@@ -1301,7 +1298,7 @@ bool CeditorDlg::Save()
{ {
wxString tStr; wxString tStr;
tStr = "Database update failed\n\n"; tStr = "Database update failed\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
failed = TRUE; failed = TRUE;
} }
@@ -1406,7 +1403,7 @@ bool CeditorDlg::GetRec(char *whereStr)
{ {
wxString tStr; wxString tStr;
tStr = "ODBC error during Query()\n\n"; tStr = "ODBC error during Query()\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(Contact->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
return(FALSE); return(FALSE);
@@ -1488,7 +1485,7 @@ void CparameterDlg::OnCloseWindow(wxCloseEvent& event)
wxEndBusyCursor(); wxEndBusyCursor();
Show(FALSE); Show(FALSE);
SetReturnCode(0); // added so BoundsChecker would not report use of uninitialized variable SetReturnCode(0); // added so BoundsChecker would not report use of uninitialized variable
this->Destroy(); this->Destroy();
} // CparameterDlg::OnCloseWindow() } // CparameterDlg::OnCloseWindow()
@@ -1500,6 +1497,7 @@ void CparameterDlg::OnButton( wxCommandEvent &event )
OnCommand( *win, event ); OnCommand( *win, event );
} }
void CparameterDlg::OnCommand(wxWindow& win, wxCommandEvent& event) void CparameterDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
wxString widgetName; wxString widgetName;
@@ -1648,7 +1646,7 @@ void CparameterDlg::FillDataSourceList()
for (i = 0; wxStrlen(p[i]); i++) for (i = 0; wxStrlen(p[i]); i++)
pParamODBCSourceList->Append(p[i]); pParamODBCSourceList->Append(p[i]);
delete p; delete p;
} // CparameterDlg::CparameterDlg::FillDataSourceList() } // CparameterDlg::CparameterDlg::FillDataSourceList()
@@ -1656,6 +1654,7 @@ BEGIN_EVENT_TABLE(CqueryDlg, wxDialog)
EVT_BUTTON(-1, CqueryDlg::OnButton) EVT_BUTTON(-1, CqueryDlg::OnButton)
EVT_CLOSE(CqueryDlg::OnCloseWindow) EVT_CLOSE(CqueryDlg::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
// CqueryDlg() constructor // CqueryDlg() constructor
CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, char *tblName[], char *pWhereArg) : wxDialog (parent, QUERY_DIALOG, "Query", wxPoint(-1, -1), wxSize(480, 360)) CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, char *tblName[], char *pWhereArg) : wxDialog (parent, QUERY_DIALOG, "Query", wxPoint(-1, -1), wxSize(480, 360))
@@ -1703,7 +1702,7 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, char *tblName[], char *pWhereA
pQuerySqlWhereMtxt = new wxTextCtrl(this, QUERY_DIALOG_WHERE_TEXT, "", wxPoint( 10, 159), wxSize(377, 134), wxTE_MULTILINE, wxDefaultValidator, "QuerySqlWhereMtxt"); pQuerySqlWhereMtxt = new wxTextCtrl(this, QUERY_DIALOG_WHERE_TEXT, "", wxPoint( 10, 159), wxSize(377, 134), wxTE_MULTILINE, wxDefaultValidator, "QuerySqlWhereMtxt");
pQueryAddBtn = new wxButton(this, QUERY_DIALOG_ADD, "&Add", wxPoint(406, 24), wxSize( 56, 26), 0, wxDefaultValidator, "QueryAddBtn"); pQueryAddBtn = new wxButton(this, QUERY_DIALOG_ADD, "&Add", wxPoint(406, 24), wxSize( 56, 26), 0, wxDefaultValidator, "QueryAddBtn");
pQueryAndBtn = new wxButton(this, QUERY_DIALOG_AND, "A&nd", wxPoint(406, 58), wxSize( 56, 26), 0, wxDefaultValidator, "QueryAndBtn"); pQueryAndBtn = new wxButton(this, QUERY_DIALOG_AND, "A&nd", wxPoint(406, 58), wxSize( 56, 26), 0, wxDefaultValidator, "QueryAndBtn");
pQueryOrBtn = new wxButton(this, QUERY_DIALOG_OR, "&Or", wxPoint(406, 92), wxSize( 56, 26), 0, wxDefaultValidator, "QueryOrBtn"); pQueryOrBtn = new wxButton(this, QUERY_DIALOG_OR, "&Or", wxPoint(406, 92), wxSize( 56, 26), 0, wxDefaultValidator, "QueryOrBtn");
pQueryLParenBtn = new wxButton(this, QUERY_DIALOG_LPAREN, "(", wxPoint(406, 126), wxSize( 26, 26), 0, wxDefaultValidator, "QueryLParenBtn"); pQueryLParenBtn = new wxButton(this, QUERY_DIALOG_LPAREN, "(", wxPoint(406, 126), wxSize( 26, 26), 0, wxDefaultValidator, "QueryLParenBtn");
pQueryRParenBtn = new wxButton(this, QUERY_DIALOG_RPAREN, ")", wxPoint(436, 126), wxSize( 26, 26), 0, wxDefaultValidator, "QueryRParenBtn"); pQueryRParenBtn = new wxButton(this, QUERY_DIALOG_RPAREN, ")", wxPoint(436, 126), wxSize( 26, 26), 0, wxDefaultValidator, "QueryRParenBtn");
pQueryDoneBtn = new wxButton(this, QUERY_DIALOG_DONE, "&Done", wxPoint(406, 185), wxSize( 56, 26), 0, wxDefaultValidator, "QueryDoneBtn"); pQueryDoneBtn = new wxButton(this, QUERY_DIALOG_DONE, "&Done", wxPoint(406, 185), wxSize( 56, 26), 0, wxDefaultValidator, "QueryDoneBtn");
@@ -1727,7 +1726,7 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, char *tblName[], char *pWhereA
wxEndBusyCursor(); wxEndBusyCursor();
wxString tStr; wxString tStr;
tStr = "ODBC error during GetColumns()\n\n"; tStr = "ODBC error during GetColumns()\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(pDb,__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
return; return;
} }
@@ -1766,7 +1765,6 @@ CqueryDlg::CqueryDlg(wxWindow *parent, wxDb *pDb, char *tblName[], char *pWhereA
// Display the dialog window // Display the dialog window
Centre(wxBOTH); Centre(wxBOTH);
ShowModal(); ShowModal();
} // CqueryDlg() constructor } // CqueryDlg() constructor
@@ -1775,11 +1773,12 @@ CqueryDlg::~CqueryDlg()
} // CqueryDlg::~CqueryDlg() destructor } // CqueryDlg::~CqueryDlg() destructor
void CqueryDlg::OnButton( wxCommandEvent &event ) void CqueryDlg::OnButton(wxCommandEvent &event)
{ {
wxWindow *win = (wxWindow*) event.GetEventObject(); wxWindow *win = (wxWindow*) event.GetEventObject();
OnCommand( *win, event ); OnCommand( *win, event );
} } // CqueryDlg::OnButton()
void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event) void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
@@ -1797,33 +1796,33 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
// Set the help text // Set the help text
switch((qryOp) pQueryOperatorChoice->GetSelection()) switch((qryOp) pQueryOperatorChoice->GetSelection())
{ {
case qryOpEQ: case qryOpEQ:
pQueryHintMsg->SetLabel(langQRY_EQ); pQueryHintMsg->SetLabel(langQRY_EQ);
break; break;
case qryOpLT: case qryOpLT:
pQueryHintMsg->SetLabel(langQRY_LT); pQueryHintMsg->SetLabel(langQRY_LT);
break; break;
case qryOpGT: case qryOpGT:
pQueryHintMsg->SetLabel(langQRY_GT); pQueryHintMsg->SetLabel(langQRY_GT);
break; break;
case qryOpLE: case qryOpLE:
pQueryHintMsg->SetLabel(langQRY_LE); pQueryHintMsg->SetLabel(langQRY_LE);
break; break;
case qryOpGE: case qryOpGE:
pQueryHintMsg->SetLabel(langQRY_GE); pQueryHintMsg->SetLabel(langQRY_GE);
break; break;
case qryOpBEGINS: case qryOpBEGINS:
pQueryHintMsg->SetLabel(langQRY_BEGINS); pQueryHintMsg->SetLabel(langQRY_BEGINS);
break; break;
case qryOpCONTAINS: case qryOpCONTAINS:
pQueryHintMsg->SetLabel(langQRY_CONTAINS); pQueryHintMsg->SetLabel(langQRY_CONTAINS);
break; break;
case qryOpLIKE: case qryOpLIKE:
pQueryHintMsg->SetLabel(langQRY_LIKE); pQueryHintMsg->SetLabel(langQRY_LIKE);
break; break;
case qryOpBETWEEN: case qryOpBETWEEN:
pQueryHintMsg->SetLabel(langQRY_BETWEEN); pQueryHintMsg->SetLabel(langQRY_BETWEEN);
break; break;
} }
// Hide the value2 widget // Hide the value2 widget
@@ -1833,57 +1832,57 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
// Disable the NOT operator for <, <=, >, >= // Disable the NOT operator for <, <=, >, >=
switch((qryOp) pQueryOperatorChoice->GetSelection()) switch((qryOp) pQueryOperatorChoice->GetSelection())
{ {
case qryOpLT: case qryOpLT:
case qryOpGT: case qryOpGT:
case qryOpLE: case qryOpLE:
case qryOpGE: case qryOpGE:
pQueryNotCheck->SetValue(0); pQueryNotCheck->SetValue(0);
pQueryNotCheck->Enable(FALSE); pQueryNotCheck->Enable(FALSE);
break; break;
default: default:
pQueryNotCheck->Enable(TRUE); pQueryNotCheck->Enable(TRUE);
break; break;
} }
// Manipulate the dialog to handle the selected operator // Manipulate the dialog to handle the selected operator
switch((qryOp) pQueryOperatorChoice->GetSelection()) switch((qryOp) pQueryOperatorChoice->GetSelection())
{ {
case qryOpEQ: case qryOpEQ:
case qryOpLT: case qryOpLT:
case qryOpGT: case qryOpGT:
case qryOpLE: case qryOpLE:
case qryOpGE: case qryOpGE:
pQueryCol2Choice->Enable(TRUE); pQueryCol2Choice->Enable(TRUE);
if (pQueryCol2Choice->GetSelection()) // Column name is highlighted if (pQueryCol2Choice->GetSelection()) // Column name is highlighted
{ {
pQueryValue1Msg->Show(FALSE); pQueryValue1Msg->Show(FALSE);
pQueryValue1Txt->Show(FALSE); pQueryValue1Txt->Show(FALSE);
} }
else // "Value" is highlighted else // "Value" is highlighted
{ {
pQueryValue1Msg->Show(TRUE);
pQueryValue1Txt->Show(TRUE);
pQueryValue1Txt->SetFocus();
}
break;
case qryOpBEGINS:
case qryOpCONTAINS:
case qryOpLIKE:
pQueryCol2Choice->SetSelection(0);
pQueryCol2Choice->Enable(FALSE);
pQueryValue1Msg->Show(TRUE); pQueryValue1Msg->Show(TRUE);
pQueryValue1Txt->Show(TRUE); pQueryValue1Txt->Show(TRUE);
pQueryValue1Txt->SetFocus(); pQueryValue1Txt->SetFocus();
} break;
break; case qryOpBETWEEN:
case qryOpBEGINS: pQueryCol2Choice->SetSelection(0);
case qryOpCONTAINS: pQueryCol2Choice->Enable(FALSE);
case qryOpLIKE: pQueryValue2Msg->Show(TRUE);
pQueryCol2Choice->SetSelection(0); pQueryValue2Txt->Show(TRUE);
pQueryCol2Choice->Enable(FALSE); pQueryValue1Msg->Show(TRUE);
pQueryValue1Msg->Show(TRUE); pQueryValue1Txt->Show(TRUE);
pQueryValue1Txt->Show(TRUE); pQueryValue1Txt->SetFocus();
pQueryValue1Txt->SetFocus(); break;
break;
case qryOpBETWEEN:
pQueryCol2Choice->SetSelection(0);
pQueryCol2Choice->Enable(FALSE);
pQueryValue2Msg->Show(TRUE);
pQueryValue2Txt->Show(TRUE);
pQueryValue1Msg->Show(TRUE);
pQueryValue1Txt->Show(TRUE);
pQueryValue1Txt->SetFocus();
break;
} }
return; return;
@@ -1905,7 +1904,6 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
pQueryValue1Txt->SetFocus(); pQueryValue1Txt->SetFocus();
} }
return; return;
} // Column 2 choice } // Column 2 choice
// Add button // Add button
@@ -1913,7 +1911,6 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
ProcessAddBtn(); ProcessAddBtn();
return; return;
} // Add button } // Add button
// And button // And button
@@ -1921,7 +1918,6 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
AppendToWhere(" AND\n"); AppendToWhere(" AND\n");
return; return;
} // And button } // And button
// Or button // Or button
@@ -1929,7 +1925,6 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
AppendToWhere(" OR\n"); AppendToWhere(" OR\n");
return; return;
} // Or button } // Or button
// Left Paren button // Left Paren button
@@ -1937,7 +1932,6 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
AppendToWhere("("); AppendToWhere("(");
return; return;
} // Left Paren button } // Left Paren button
// Right paren button // Right paren button
@@ -1945,7 +1939,6 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
{ {
AppendToWhere(")"); AppendToWhere(")");
return; return;
} // Right Paren button } // Right Paren button
// Done button // Done button
@@ -1966,7 +1959,6 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
wxStrcpy(pWhere, pQuerySqlWhereMtxt->GetValue()); wxStrcpy(pWhere, pQuerySqlWhereMtxt->GetValue());
Close(); Close();
return; return;
} // Done button } // Done button
// Clear button // Clear button
@@ -1977,7 +1969,6 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
if (Ok) if (Ok)
pQuerySqlWhereMtxt->SetValue(""); pQuerySqlWhereMtxt->SetValue("");
return; return;
} // Clear button } // Clear button
// Count button // Count button
@@ -1987,7 +1978,6 @@ void CqueryDlg::OnCommand(wxWindow& win, wxCommandEvent& event)
ProcessCountBtn(); ProcessCountBtn();
wxEndBusyCursor(); wxEndBusyCursor();
return; return;
} // Count button } // Count button
} // CqueryDlg::OnCommand } // CqueryDlg::OnCommand
@@ -2013,7 +2003,7 @@ void CqueryDlg::OnCloseWindow(wxCloseEvent& event)
wxEndBusyCursor(); wxEndBusyCursor();
Show(FALSE); Show(FALSE);
SetReturnCode(1); // added so BoundsChecker would not report use of uninitialized variable SetReturnCode(1); // added so BoundsChecker would not report use of uninitialized variable
this->Destroy(); this->Destroy();
} // CqueryDlg::OnCloseWindow() } // CqueryDlg::OnCloseWindow()
@@ -2021,10 +2011,9 @@ void CqueryDlg::OnCloseWindow(wxCloseEvent& event)
void CqueryDlg::AppendToWhere(char *s) void CqueryDlg::AppendToWhere(char *s)
{ {
wxString whereStr = pQuerySqlWhereMtxt->GetValue(); wxString whereStr = pQuerySqlWhereMtxt->GetValue();
whereStr += s; whereStr += s;
pQuerySqlWhereMtxt->SetValue(whereStr); pQuerySqlWhereMtxt->SetValue(whereStr);
} // CqueryDlg::AppendToWhere() } // CqueryDlg::AppendToWhere()
@@ -2145,7 +2134,7 @@ void CqueryDlg::ProcessCountBtn()
{ {
wxString tStr; wxString tStr;
tStr = "ODBC error during Open()\n\n"; tStr = "ODBC error during Open()\n\n";
tStr += GetExtendedDBErrorMsg(__FILE__,__LINE__); tStr += GetExtendedDBErrorMsg(dbTable->GetDb(),__FILE__,__LINE__);
wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION); wxMessageBox(tStr,"ODBC Error...",wxOK | wxICON_EXCLAMATION);
return; return;
} }

View File

@@ -151,8 +151,8 @@ DECLARE_EVENT_TABLE()
class CeditorDlg : public wxPanel class CeditorDlg : public wxPanel
{ {
private: private:
bool widgetPtrsSet; bool widgetPtrsSet;
wxString saveName; wxString saveName;
// Pointers to all widgets on the dialog // Pointers to all widgets on the dialog
wxButton *pCreateBtn, *pEditBtn, *pDeleteBtn, *pCopyBtn, *pSaveBtn, *pCancelBtn; wxButton *pCreateBtn, *pEditBtn, *pDeleteBtn, *pCopyBtn, *pSaveBtn, *pCancelBtn;
@@ -167,9 +167,9 @@ class CeditorDlg : public wxPanel
wxStaticText *pNativeLangMsg; wxStaticText *pNativeLangMsg;
public: public:
bool initialized; bool initialized;
enum DialogModes mode; enum DialogModes mode;
Ccontact *Contact; // this is the table object that will be being manipulated Ccontact *Contact; // this is the table object that will be being manipulated
CeditorDlg(wxWindow *parent); CeditorDlg(wxWindow *parent);
@@ -178,7 +178,7 @@ class CeditorDlg : public wxPanel
void OnCommand(wxWindow& win, wxCommandEvent& event); void OnCommand(wxWindow& win, wxCommandEvent& event);
void OnActivate(bool) {}; // necessary for hot keys void OnActivate(bool) {}; // necessary for hot keys
bool Initialize(); bool Initialize();
void FieldsEditable(); void FieldsEditable();
void SetMode(enum DialogModes m); void SetMode(enum DialogModes m);
bool PutData(); bool PutData();
@@ -349,7 +349,7 @@ class CqueryDlg : public wxDialog
wxStaticBox *pQueryHintGrp; wxStaticBox *pQueryHintGrp;
wxStaticText *pQueryHintMsg; wxStaticText *pQueryHintMsg;
wxTextCtrl *pFocusTxt; wxTextCtrl *pFocusTxt;
CqueryDlg(wxWindow *parent, wxDb *pDb, char *tblName[], char *pWhereArg); CqueryDlg(wxWindow *parent, wxDb *pDb, char *tblName[], char *pWhereArg);
~CqueryDlg(); ~CqueryDlg();

View File

@@ -411,8 +411,10 @@ void ClookUpDlg::OnClose(wxCloseEvent& event)
if (lookup2) if (lookup2)
delete lookup2; delete lookup2;
SetReturnCode(1);
while (wxIsBusy()) wxEndBusyCursor(); while (wxIsBusy()) wxEndBusyCursor();
event.Skip(); event.Skip();
// return TRUE; // return TRUE;