1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxWindows validation sample
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
17 #include "wx/combobox.h"
18 #include "wx/dialog.h"
19 #include "wx/dynarray.h"
21 #include "wx/listbox.h"
22 #include "wx/string.h"
24 // Define a new application type
25 class MyApp
: public wxApp
31 // Define a new frame type
32 class MyFrame
: public wxFrame
35 MyFrame(wxFrame
*frame
, const char *title
, int x
, int y
, int w
, int h
);
37 void OnQuit(wxCommandEvent
& event
);
38 void OnTestDialog(wxCommandEvent
& event
);
39 void OnToggleBell(wxCommandEvent
& event
);
48 class MyDialog
: public wxDialog
51 MyDialog(wxWindow
*parent
, const wxString
& title
,
52 const wxPoint
& pos
= wxDefaultPosition
,
53 const wxSize
& size
= wxDefaultSize
,
54 const long style
= wxDEFAULT_DIALOG_STYLE
);
55 bool TransferDataToWindow();
64 // These data members are designed for transfer to and from
65 // controls, via validators. For instance, a text control's
66 // transferred value is a string:
68 // Listboxes may permit multiple selections, so their state
69 // is transferred to an integer-array class.
70 wxArrayInt m_listbox_choices
;
71 bool m_checkbox_state
;
72 // Comboboxes differ from listboxes--validators transfer
73 // the string entered in the combobox's text-edit field.
74 wxString m_combobox_choice
;
75 int m_radiobox_choice
;
78 #define VALIDATE_DIALOG_ID 200
80 #define VALIDATE_TEST_DIALOG 2
81 #define VALIDATE_TOGGLE_BELL 3
83 #define VALIDATE_TEXT 101
84 #define VALIDATE_LIST 102
85 #define VALIDATE_CHECK 103
86 #define VALIDATE_COMBO 105
87 #define VALIDATE_RADIO 106