- private:
- bool widgetPtrsSet;
- wxString saveName;
-
- // Pointers to all widgets on the dialog
- wxButton *pCreateBtn, *pEditBtn, *pDeleteBtn, *pCopyBtn, *pSaveBtn, *pCancelBtn;
- wxButton *pPrevBtn, *pNextBtn, *pQueryBtn, *pResetBtn, *pDoneBtn, *pHelpBtn;
- wxButton *pNameListBtn;
- wxTextCtrl *pNameTxt, *pAddress1Txt, *pAddress2Txt,*pCityTxt, *pStateTxt, *pCountryTxt,*pPostalCodeTxt;
- wxStaticText *pNameMsg, *pAddress1Msg, *pAddress2Msg,*pCityMsg, *pStateMsg, *pCountryMsg,*pPostalCodeMsg;
- wxTextCtrl *pJoinDateTxt,*pContribTxt, *pLinesTxt;
- wxStaticText *pJoinDateMsg,*pContribMsg, *pLinesMsg;
- wxRadioBox *pDeveloperRadio;
- wxChoice *pNativeLangChoice;
- wxStaticText *pNativeLangMsg;
-
- public:
- enum DialogModes mode;
- Ccontact *Contact; // this is the table object that will be being manipulated
-
- CeditorDlg(wxWindow *parent);
- void OnCloseWindow(wxCloseEvent& event);
- void OnButton( wxCommandEvent &event );
- void OnCommand(wxWindow& win, wxCommandEvent& event);
- void OnActivate(bool) {}; // necessary for hot keys
-
- void FieldsEditable();
- void SetMode(enum DialogModes m);
- bool PutData();
- bool GetData();
- bool Save();
- bool GetNextRec();
- bool GetPrevRec();
- bool GetRec(char *whereStr);
-
+ private:
+ // Used to indicate whether all of the widget pointers (defined
+ // below) have been initialized to point to the memory for
+ // the named widget. Used as a safeguard from using the widget
+ // before it has been initialized.
+ bool widgetPtrsSet;
+
+ // Used when the EDIT button has been pressed to maintain the
+ // original name that was displayed in the editor before the
+ // EDIT button was pressed, so that if CANCEL is pressed, a
+ // FetchByName() can be done to retrieve the original data
+ // to repopulate the dialog.
+ wxString saveName;
+
+ // Pointers to all widgets on the dialog
+ wxButton *pCreateBtn, *pEditBtn, *pDeleteBtn, *pCopyBtn, *pSaveBtn, *pCancelBtn;
+ wxButton *pPrevBtn, *pNextBtn, *pQueryBtn, *pResetBtn, *pDoneBtn, *pHelpBtn;
+ wxButton *pNameListBtn;
+ wxTextCtrl *pNameTxt, *pAddress1Txt, *pAddress2Txt,*pCityTxt, *pStateTxt, *pCountryTxt,*pPostalCodeTxt;
+ wxStaticText *pNameMsg, *pAddress1Msg, *pAddress2Msg,*pCityMsg, *pStateMsg, *pCountryMsg,*pPostalCodeMsg;
+ wxTextCtrl *pJoinDateTxt,*pContribTxt, *pLinesTxt;
+ wxStaticText *pJoinDateMsg,*pContribMsg, *pLinesMsg;
+ wxRadioBox *pDeveloperRadio;
+ wxChoice *pNativeLangChoice;
+ wxStaticText *pNativeLangMsg;
+
+ public:
+ // Indicates if the editor dialog has been initialized yet (used to
+ // help trap if the Initialize() function failed to load all required
+ // resources or not.
+ bool initialized;
+
+ enum DialogModes mode;
+
+ // Pointer to the wxDbTable instance that is used to manipulate
+ // the data in memory and in the database
+ Ccontact *Contact;
+
+ CeditorDlg(wxWindow *parent);
+
+ void OnCloseWindow(wxCloseEvent& event);
+ void OnButton( wxCommandEvent &event );
+ void OnCommand(wxWindow& win, wxCommandEvent& event);
+ void OnActivate(bool) {}; // necessary for hot keys
+
+ bool Initialize();
+
+ // Sets wxStaticText fields to be editable or not depending
+ // on the current value of 'mode'
+ void FieldsEditable();
+
+ // Sets the editor mode, determining what state widgets
+ // on the dialog are to be in based on the operation
+ // being performed.
+ void SetMode(enum DialogModes m);
+
+ // Update/Retrieve data from the widgets on the dialog
+ bool PutData();
+ bool GetData();
+
+ // Inserts/updates the database with the current data
+ // retrieved from the editor dialog
+ bool Save();
+
+ // Database functions for changing the data that is to
+ // be displayed on the dialog. GetNextRec()/GetPrevRec()
+ // provide database independent methods that do not require
+ // backward scrolling cursors to obtain the record that
+ // is prior to the current record in the search sequence.
+ bool GetNextRec();
+ bool GetPrevRec();
+ bool GetRec(const wxString &whereStr);
+