29 wxDatePickerCtrl * date = (wxDatePickerCtrl *) m_validatorWindow;
30 *
pdt = date->GetValue();
34 wxDatePickerCtrl * date = (wxDatePickerCtrl *) m_validatorWindow;
35 date->SetValue (*
pdt);
55 wxTimePickerCtrl * date = (wxTimePickerCtrl *) m_validatorWindow;
56 *
pdt = date->GetValue();
60 wxTimePickerCtrl * date = (wxTimePickerCtrl *) m_validatorWindow;
61 date->SetValue (*
pdt);
67 #include <wx/string.h>
97 choiceOK = pdb->FillChoice (choiceProject,
project_tid);
98 choiceOK = pdb->FillChoice (choiceTask,
task_tid);
99 choiceOK = pdb->FillChoice (choiceTool,
tool_tid);
100 if (!choiceOK) wxLogError (
"Initialization of choices failed (yatishDlgTimeslot)");
101 long activity_id = pdb->Activity (
id);
102 project = pdb->ChoiceSelector (
project_tid, activity_id);
103 task = pdb->ChoiceSelector (
task_tid, activity_id);
104 tool = pdb->ChoiceSelector (
tool_tid, activity_id);
105 choiceProject->SetValidator ( wxGenericValidator (&project) );
106 choiceTask ->SetValidator ( wxGenericValidator (&task) );
107 choiceTool ->SetValidator ( wxGenericValidator (&tool) );
108 if ( pdb->ReadDates (
id, date1, date2) ) {
111 time1 = date1; time2 = date2;
115 wxLogError (
"Initialization of dates failed (yatishDlgTimeslot)");
116 Fit(); SetMaxSize ( GetSize() );
129 if (!choiceOK) wxLogError (
"Initialization of choices failed (yatishDlgTimeslot)");
142 Fit(); SetMaxSize ( GetSize() );
150 wxBoxSizer* BoxSizer1;
151 wxBoxSizer* BoxSizer2;
152 wxButton* buttonCancel;
153 wxFlexGridSizer* FlexGridSizer1;
154 wxStaticText* StaticText1;
155 wxStaticText* StaticText2;
157 Create(0, wxID_ANY, _(
"Table: yatish_timeslot"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T(
"wxID_ANY"));
158 BoxSizer1 =
new wxBoxSizer(wxVERTICAL);
159 staticBoxSizer =
new wxStaticBoxSizer(wxHORIZONTAL,
this, _(
"(previously selected row)"));
160 FlexGridSizer1 =
new wxFlexGridSizer(3, 3, 0, 0);
161 StaticText1 =
new wxStaticText(
this, wxID_ANY, _(
"Start:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"wxID_ANY"));
162 FlexGridSizer1->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
163 datePicker1 =
new wxDatePickerCtrl(
this,
idDatePicker1, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT|wxDP_SHOWCENTURY, wxDefaultValidator, _T(
"idDatePicker1"));
164 FlexGridSizer1->Add(
datePicker1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
165 timePicker1 =
new wxTimePickerCtrl(
this,
idTimePicker1,wxDefaultDateTime,wxDefaultPosition,wxDefaultSize,wxDP_DEFAULT,wxDefaultValidator,_T(
"idTimePicker1"));
166 FlexGridSizer1->Add(
timePicker1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
167 StaticText2 =
new wxStaticText(
this, wxID_ANY, _(
"Stop:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"wxID_ANY"));
168 FlexGridSizer1->Add(StaticText2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
169 datePicker2 =
new wxDatePickerCtrl(
this,
idDatePicker2, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT|wxDP_SHOWCENTURY, wxDefaultValidator, _T(
"idDatePicker2"));
170 FlexGridSizer1->Add(
datePicker2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
171 timePicker2 =
new wxTimePickerCtrl(
this,
idTimePicker2,wxDefaultDateTime,wxDefaultPosition,wxDefaultSize,wxDP_DEFAULT,wxDefaultValidator,_T(
"idTimePicker2"));
172 FlexGridSizer1->Add(
timePicker2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
173 choiceProject =
new wxChoice(
this,
idChoiceProject, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T(
"idChoiceProject"));
174 FlexGridSizer1->Add(
choiceProject, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
175 choiceTask =
new wxChoice(
this,
idChoiceTask, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T(
"idChoiceTask"));
176 FlexGridSizer1->Add(
choiceTask, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
177 choiceTool =
new wxChoice(
this,
idChoiceTool, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T(
"idChoiceTool"));
178 FlexGridSizer1->Add(
choiceTool, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
179 staticBoxSizer->Add(FlexGridSizer1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
180 BoxSizer1->Add(
staticBoxSizer, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
181 BoxSizer2 =
new wxBoxSizer(wxHORIZONTAL);
182 buttonCancel =
new wxButton(
this, wxID_CANCEL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"wxID_CANCEL"));
183 BoxSizer2->Add(buttonCancel, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
184 buttonSave =
new wxButton(
this, wxID_SAVE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"wxID_SAVE"));
185 BoxSizer2->Add(
buttonSave, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
186 buttonNew =
new wxButton(
this, wxID_NEW, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"wxID_NEW"));
187 BoxSizer2->Add(
buttonNew, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
188 BoxSizer1->Add(BoxSizer2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
190 BoxSizer1->Fit(
this);
191 BoxSizer1->SetSizeHints(
this);
204 TransferDataFromWindow();
208 EndModal (wxID_SAVE);
210 EndModal (wxID_CANCEL);
214 TransferDataFromWindow();
220 EndModal (wxID_CANCEL);
Simplified from the wxWidgets Wiki:
bool TransferFromWindow()
bool Validate(wxWindow *)
DateValidator(wxDateTime *p)
DateValidator(const DateValidator &v)
This class is necessary because wxGenericValidator doesn't support wxTimePickerCtrl.
TimeValidator(const TimeValidator &v)
bool TransferFromWindow()
TimeValidator(wxDateTime *p)
bool Validate(wxWindow *)
Interacts with yatish tables in a SQLite database.
bool FillChoice(wxChoice *, tableID)
Fills a wxChoice.
bool RecordTimeslot(long, const wxDateTime &, const wxDateTime &, int, int, int)
Modifies or creates a record in the yatish_timeslot table.
wxDatePickerCtrl * datePicker2
static const long idChoiceProject
static const long idChoiceTask
static const long idTimePicker1
yatishDlgTimeslot(yatishDBsqlite *, long)
This constructor initializes the dialog box with data from the SQL record identified by sql_id.
wxDatePickerCtrl * datePicker1
void OnButtonSaveClick(wxCommandEvent &event)
wxStaticBoxSizer * staticBoxSizer
wxTimePickerCtrl * timePicker1
static const long idDatePicker2
void OnButtonNewClick(wxCommandEvent &event)
wxTimePickerCtrl * timePicker2
static const long idDatePicker1
static const long idChoiceTool
static const long idTimePicker2