1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxWidgets validation sample
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/combobox.h"
14 #include "wx/dialog.h"
15 #include "wx/dynarray.h"
17 #include "wx/listbox.h"
18 #include "wx/string.h"
20 // Define a new application type
21 class MyApp
: public wxApp
27 // Define a new frame type
28 class MyFrame
: public wxFrame
31 MyFrame(wxFrame
*frame
, const wxString
&title
, int x
, int y
, int w
, int h
);
33 void OnQuit(wxCommandEvent
& event
);
34 void OnTestDialog(wxCommandEvent
& event
);
35 void OnToggleBell(wxCommandEvent
& event
);
44 class MyDialog
: public wxDialog
47 MyDialog(wxWindow
*parent
, const wxString
& title
,
48 const wxPoint
& pos
= wxDefaultPosition
,
49 const wxSize
& size
= wxDefaultSize
,
50 const long style
= wxDEFAULT_DIALOG_STYLE
);
51 bool TransferDataToWindow();
60 // These data members are designed for transfer to and from
61 // controls, via validators. For instance, a text control's
62 // transferred value is a string:
64 // Listboxes may permit multiple selections, so their state
65 // is transferred to an integer-array class.
66 wxArrayInt m_listbox_choices
;
67 bool m_checkbox_state
;
68 // Comboboxes differ from listboxes--validators transfer
69 // the string entered in the combobox's text-edit field.
70 wxString m_combobox_choice
;
71 int m_radiobox_choice
;
74 #define VALIDATE_DIALOG_ID 200
76 #define VALIDATE_TEST_DIALOG 2
77 #define VALIDATE_TOGGLE_BELL 3
79 #define VALIDATE_TEXT 101
80 #define VALIDATE_LIST 102
81 #define VALIDATE_CHECK 103
82 #define VALIDATE_COMBO 105
83 #define VALIDATE_RADIO 106