| |
Adding a dialog
Adding a
Dialog box is fairly simple. Here are the steps.
-
create a new IF_MY_DLG.h
and IF_MY_DLG.cpp. Each dialog should have it's own set of
files.
-
Copy App 1 into the .h
file. Change the my_dlg to <whatever>_dlg
-
In IF_Master.h add
#include
"IF_MY_DLG.h"
-
Copy App 2 into the .CPP
file. Edit my.dlg etc.
-
Add your events etc ...
See next sections.
App 1
class my_dlg : public wxDialog
{
public:
my_dlg(wxWindow *parent);
protected:
void mySelect(wxCommandEvent &event);
void my_dlg::OnText(wxCommandEvent &event);
private:
DECLARE_EVENT_TABLE() // important .. don't delete
// Dialog text field vars. To save data to.
wxTextCtrl *text1;
wxTextCtrl *text2;
// ID's for above.
enum
{
ID_TEXT1,
ID_TEXT2
};
};
#endif
APP 2
MY_dlg::MY_dlg(wxWindow *parent) : wxDialog(NULL, -1, "sql_connect_Dialog",
wxDefaultPosition, wxSize(600, 600) )
void my_dlg::OnText(wxCommandEvent &event)
{
wxLogMessage("You've selected item: " + event.GetString());
}
BEGIN_EVENT_TABLE(my_dlg, wxDialog)
EVT_TEXT(ID_TEXT1, OnText)
EVT_TEXT(ID_TEXT2, OnText)
END_EVENT_TABLE()
wxLog.
There are a few wxLog functions that i think we should use for our logging.
- wxLogError.
- wxLogwarning
- wxLogMessage.
These provide global log messages that you can send to a text file.
|