]> git.saurik.com Git - wxWidgets.git/blob - samples/editlbox/editlbox.cpp
call event.Enable(true) in OnUpdateFileOpen and OnUpdateFileNew only if there are...
[wxWidgets.git] / samples / editlbox / editlbox.cpp
1 // For compilers that support precompilation, includes "wx/wx.h".
2 #include "wx/wxprec.h"
3
4 #ifdef __BORLANDC__
5 #pragma hdrstop
6 #endif
7
8 // for all others, include the necessary headers (this file is usually all you
9 // need because it includes almost all "standard" wxWidgets headers)
10 #ifndef WX_PRECOMP
11 #include "wx/wx.h"
12 #endif
13
14 #include "wx/editlbox.h"
15 #include "wx/sizer.h"
16
17 class MyApp : public wxApp
18 {
19 public:
20 virtual bool OnInit();
21 };
22
23 IMPLEMENT_APP(MyApp)
24
25
26 bool MyApp::OnInit()
27 {
28 wxDialog dlg(NULL, wxID_ANY, _("Test dialog"), wxDefaultPosition, wxDefaultSize,
29 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
30
31 wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
32 sizer->Add(new wxEditableListBox(&dlg, wxID_ANY, _("Match these wildcards:"),
33 wxDefaultPosition,wxSize(300,200)),
34 1, wxEXPAND|wxALL, 10);
35
36 sizer->Add(5,5);
37
38 wxEditableListBox *lb = new wxEditableListBox(&dlg, wxID_ANY, _("Except:"),
39 wxDefaultPosition,wxSize(300,200));
40 wxArrayString ar;
41 ar.Add(_T("*.cpp"));
42 ar.Add(_T("*.h"));
43 ar.Add(_T("*.c"));
44 lb->SetStrings(ar);
45
46 sizer->Add(lb, 1, wxEXPAND|wxALL, 10);
47
48 sizer->Add(5,5);
49
50 sizer->Add(new wxButton(&dlg, wxID_OK, _("OK")), 0, wxALIGN_RIGHT | wxALL, 10);
51 dlg.SetSizerAndFit(sizer);
52 dlg.Centre();
53
54 dlg.ShowModal();
55
56 wxString res = _("'Except' contains these strings:\n\n");
57 lb->GetStrings(ar);
58 for (size_t i = 0; i < ar.GetCount(); i++)
59 res << ar[i] << _T("\n");
60 wxMessageBox(res);
61
62 return false;
63 }