1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxHelpController demo
4 // Author: Karsten Ballueder
8 // Copyright: (c) Karsten Ballueder, Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx/wx.h".
21 #include "wx/wxprec.h"
27 // for all others, include the necessary headers (this file is usually all you
28 // need because it includes almost all "standard" wxWidgets headers
33 # include "wx/image.h"
35 # include "wx/cshelp.h"
38 # include "wx/tooltip.h"
41 // define this to 1 to use HTML help even under Windows (by default, Windows
42 // version will use WinHelp).
43 // Please also see samples/html/helpview.
44 #define USE_HTML_HELP 1
46 // define this to 1 to use external help controller (not used by default)
47 #define USE_EXT_HELP 0
49 // Define this to 0 to use the help controller as the help
50 // provider, or to 1 to use the 'simple help provider'
51 // (the one implemented with wxTipWindow).
52 #define USE_SIMPLE_HELP_PROVIDER 0
56 #define USE_HTML_HELP 0
60 #include "wx/filesys.h"
61 #include "wx/fs_zip.h"
63 #include "wx/html/helpctrl.h"
66 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
67 #include "wx/msw/helpchm.h"
70 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
71 #include "wx/msw/helpbest.h"
75 #include "wx/generic/helpext.h"
78 // ----------------------------------------------------------------------------
80 // ----------------------------------------------------------------------------
81 // the application icon
82 #if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__)
83 #include "mondrian.xpm"
86 // ----------------------------------------------------------------------------
88 // ----------------------------------------------------------------------------
90 // Define a new application type, each program should derive a class from wxApp
91 class MyApp
: public wxApp
94 // override base class virtuals
95 // ----------------------------
97 // this one is called on application startup and is a good place for the app
98 // initialization (doing it here and not in the ctor allows to have an error
99 // return: if OnInit() returns false, the application terminates)
100 virtual bool OnInit();
102 // do some clean up here
103 virtual int OnExit();
106 // Define a new frame type: this is going to be our main frame
107 class MyFrame
: public wxFrame
111 MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
);
113 wxHelpControllerBase
& GetHelpController() { return m_help
; }
116 wxHtmlHelpController
& GetAdvancedHtmlHelpController() { return m_advancedHtmlHelp
; }
118 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
119 wxCHMHelpController
& GetMSHtmlHelpController() { return m_msHtmlHelp
; }
121 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
122 wxBestHelpController
& GetBestHelpController() { return m_bestHelp
; }
125 // event handlers (these functions should _not_ be virtual)
126 void OnQuit(wxCommandEvent
& event
);
127 void OnHelp(wxCommandEvent
& event
);
128 void OnAdvancedHtmlHelp(wxCommandEvent
& event
);
129 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
130 void OnMSHtmlHelp(wxCommandEvent
& event
);
132 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
133 void OnBestHelp(wxCommandEvent
& event
);
136 void OnModalHtmlHelp(wxCommandEvent
& event
);
139 void OnShowContextHelp(wxCommandEvent
& event
);
140 void OnShowDialogContextHelp(wxCommandEvent
& event
);
142 void ShowHelp(int commandId
, wxHelpControllerBase
& helpController
);
146 wxExtHelpController m_help
;
148 wxHelpController m_help
;
152 wxHtmlHelpController m_advancedHtmlHelp
;
153 wxHtmlHelpController m_embeddedHtmlHelp
;
154 wxHtmlHelpWindow
* m_embeddedHelpWindow
;
157 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
158 wxCHMHelpController m_msHtmlHelp
;
161 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
162 wxBestHelpController m_bestHelp
;
165 // any class wishing to process wxWidgets events must use this macro
166 DECLARE_EVENT_TABLE()
169 // A custom modal dialog
170 class MyModalDialog
: public wxDialog
173 MyModalDialog(wxWindow
*parent
);
177 DECLARE_EVENT_TABLE()
180 // ----------------------------------------------------------------------------
182 // ----------------------------------------------------------------------------
184 // IDs for the controls and the menu commands
190 HelpDemo_Help_Classes
,
191 HelpDemo_Help_Functions
,
193 HelpDemo_Help_Search
,
194 HelpDemo_Help_ContextHelp
,
195 HelpDemo_Help_DialogContextHelp
,
197 HelpDemo_Html_Help_Index
,
198 HelpDemo_Html_Help_Classes
,
199 HelpDemo_Html_Help_Functions
,
200 HelpDemo_Html_Help_Help
,
201 HelpDemo_Html_Help_Search
,
203 HelpDemo_Advanced_Html_Help_Index
,
204 HelpDemo_Advanced_Html_Help_Classes
,
205 HelpDemo_Advanced_Html_Help_Functions
,
206 HelpDemo_Advanced_Html_Help_Help
,
207 HelpDemo_Advanced_Html_Help_Search
,
208 HelpDemo_Advanced_Html_Help_Modal
,
210 HelpDemo_MS_Html_Help_Index
,
211 HelpDemo_MS_Html_Help_Classes
,
212 HelpDemo_MS_Html_Help_Functions
,
213 HelpDemo_MS_Html_Help_Help
,
214 HelpDemo_MS_Html_Help_Search
,
216 HelpDemo_Best_Help_Index
,
217 HelpDemo_Best_Help_Classes
,
218 HelpDemo_Best_Help_Functions
,
219 HelpDemo_Best_Help_Help
,
220 HelpDemo_Best_Help_Search
,
224 HelpDemo_Help_Netscape
,
225 // controls start here (the numbers are, of course, arbitrary)
229 // ----------------------------------------------------------------------------
230 // event tables and other macros for wxWidgets
231 // ----------------------------------------------------------------------------
233 // the event tables connect the wxWidgets events with the functions (event
234 // handlers) which process them. It can be also done at run-time, but for the
235 // simple menu events like this the static method is much simpler.
236 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
237 EVT_MENU(HelpDemo_Quit
, MyFrame::OnQuit
)
238 EVT_MENU(HelpDemo_Help_Index
, MyFrame::OnHelp
)
239 EVT_MENU(HelpDemo_Help_Classes
, MyFrame::OnHelp
)
240 EVT_MENU(HelpDemo_Help_Functions
, MyFrame::OnHelp
)
241 EVT_MENU(HelpDemo_Help_Help
, MyFrame::OnHelp
)
242 EVT_MENU(HelpDemo_Help_Search
, MyFrame::OnHelp
)
243 EVT_MENU(HelpDemo_Help_ContextHelp
, MyFrame::OnShowContextHelp
)
244 EVT_MENU(HelpDemo_Help_DialogContextHelp
, MyFrame::OnShowDialogContextHelp
)
246 EVT_MENU(HelpDemo_Advanced_Html_Help_Index
, MyFrame::OnAdvancedHtmlHelp
)
247 EVT_MENU(HelpDemo_Advanced_Html_Help_Classes
, MyFrame::OnAdvancedHtmlHelp
)
248 EVT_MENU(HelpDemo_Advanced_Html_Help_Functions
, MyFrame::OnAdvancedHtmlHelp
)
249 EVT_MENU(HelpDemo_Advanced_Html_Help_Help
, MyFrame::OnAdvancedHtmlHelp
)
250 EVT_MENU(HelpDemo_Advanced_Html_Help_Search
, MyFrame::OnAdvancedHtmlHelp
)
252 EVT_MENU(HelpDemo_Advanced_Html_Help_Modal
, MyFrame::OnModalHtmlHelp
)
255 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
256 EVT_MENU(HelpDemo_MS_Html_Help_Index
, MyFrame::OnMSHtmlHelp
)
257 EVT_MENU(HelpDemo_MS_Html_Help_Classes
, MyFrame::OnMSHtmlHelp
)
258 EVT_MENU(HelpDemo_MS_Html_Help_Functions
, MyFrame::OnMSHtmlHelp
)
259 EVT_MENU(HelpDemo_MS_Html_Help_Help
, MyFrame::OnMSHtmlHelp
)
260 EVT_MENU(HelpDemo_MS_Html_Help_Search
, MyFrame::OnMSHtmlHelp
)
263 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
264 EVT_MENU(HelpDemo_Best_Help_Index
, MyFrame::OnBestHelp
)
267 EVT_MENU(HelpDemo_Help_KDE
, MyFrame::OnHelp
)
268 EVT_MENU(HelpDemo_Help_GNOME
, MyFrame::OnHelp
)
269 EVT_MENU(HelpDemo_Help_Netscape
, MyFrame::OnHelp
)
272 // Create a new application object: this macro will allow wxWidgets to create
273 // the application object during program execution (it's better than using a
274 // static object for many reasons) and also declares the accessor function
275 // wxGetApp() which will return the reference of the right type (i.e. MyApp and
279 // ============================================================================
281 // ============================================================================
283 // ----------------------------------------------------------------------------
284 // the application class
285 // ----------------------------------------------------------------------------
287 // `Main program' equivalent: the program execution "starts" here
290 if ( !wxApp::OnInit() )
293 // Create a simple help provider to make SetHelpText() do something.
294 // Note that this must be set before any SetHelpText() calls are made.
295 #if USE_SIMPLE_HELP_PROVIDER
296 wxSimpleHelpProvider
* provider
= new wxSimpleHelpProvider
;
298 wxHelpControllerHelpProvider
* provider
= new wxHelpControllerHelpProvider
;
300 wxHelpProvider::Set(provider
);
304 // Required for images in the online documentation
305 wxImage::AddHandler(new wxGIFHandler
);
308 // Required for advanced HTML help
309 #if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
310 wxFileSystem::AddHandler(new wxZipFSHandler
);
314 // Create the main application window
315 MyFrame
*frame
= new MyFrame(wxT("HelpDemo wxWidgets App"),
316 wxPoint(50, 50), wxSize(450, 340));
318 #if !USE_SIMPLE_HELP_PROVIDER
319 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
320 provider
->SetHelpController(& frame
->GetMSHtmlHelpController());
322 provider
->SetHelpController(& frame
->GetHelpController());
324 #endif // !USE_SIMPLE_HELP_PROVIDER
329 // initialise the help system: this means that we'll use doc.hlp file under
330 // Windows and that the HTML docs are in the subdirectory doc for platforms
332 if ( !frame
->GetHelpController().Initialize(wxT("doc")) )
334 wxLogError(wxT("Cannot initialize the help system, aborting."));
339 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
340 if( !frame
->GetMSHtmlHelpController().Initialize(wxT("doc")) )
342 wxLogError(wxT("Cannot initialize the MS HTML Help system."));
346 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
347 // you need to call Initialize in order to use wxBestHelpController
348 if( !frame
->GetBestHelpController().Initialize(wxT("doc")) )
350 wxLogError(wxT("Cannot initialize the best help system, aborting."));
355 // initialise the advanced HTML help system: this means that the HTML docs are in .htb
357 if ( !frame
->GetAdvancedHtmlHelpController().Initialize(wxT("doc")) )
359 wxLogError(wxT("Cannot initialize the advanced HTML help system, aborting."));
366 // defined(__WXMSW__) && wxUSE_MS_HTML_HELP
367 wxString
path(wxGetCwd());
368 if ( !frame
->GetMSHtmlHelpController().Initialize(path
+ wxT("\\doc.chm")) )
370 wxLogError("Cannot initialize the MS HTML help system, aborting.");
382 delete wxHelpProvider::Set(NULL
);
387 // ----------------------------------------------------------------------------
389 // ----------------------------------------------------------------------------
392 MyFrame::MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
)
393 : wxFrame((wxFrame
*)NULL
, 300, title
, pos
, size
)
395 , m_embeddedHtmlHelp(wxHF_EMBEDDED
|wxHF_DEFAULT_STYLE
)
398 // set the frame icon
399 SetIcon(wxICON(mondrian
));
402 wxMenu
*menuFile
= new wxMenu
;
404 menuFile
->Append(HelpDemo_Help_Index
, wxT("&Help Index..."));
405 menuFile
->Append(HelpDemo_Help_Classes
, wxT("&Help on Classes..."));
406 menuFile
->Append(HelpDemo_Help_Functions
, wxT("&Help on Functions..."));
407 menuFile
->Append(HelpDemo_Help_ContextHelp
, wxT("&Context Help..."));
408 menuFile
->Append(HelpDemo_Help_DialogContextHelp
, wxT("&Dialog Context Help...\tCtrl-H"));
409 menuFile
->Append(HelpDemo_Help_Help
, wxT("&About Help Demo..."));
410 menuFile
->Append(HelpDemo_Help_Search
, wxT("&Search help..."));
412 menuFile
->AppendSeparator();
413 menuFile
->Append(HelpDemo_Advanced_Html_Help_Index
, wxT("Advanced HTML &Help Index..."));
414 menuFile
->Append(HelpDemo_Advanced_Html_Help_Classes
, wxT("Advanced HTML &Help on Classes..."));
415 menuFile
->Append(HelpDemo_Advanced_Html_Help_Functions
, wxT("Advanced HTML &Help on Functions..."));
416 menuFile
->Append(HelpDemo_Advanced_Html_Help_Help
, wxT("Advanced HTML &About Help Demo..."));
417 menuFile
->Append(HelpDemo_Advanced_Html_Help_Search
, wxT("Advanced HTML &Search help..."));
418 menuFile
->Append(HelpDemo_Advanced_Html_Help_Modal
, wxT("Advanced HTML Help &Modal Dialog..."));
421 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
422 menuFile
->AppendSeparator();
423 menuFile
->Append(HelpDemo_MS_Html_Help_Index
, wxT("MS HTML &Help Index..."));
424 menuFile
->Append(HelpDemo_MS_Html_Help_Classes
, wxT("MS HTML &Help on Classes..."));
425 menuFile
->Append(HelpDemo_MS_Html_Help_Functions
, wxT("MS HTML &Help on Functions..."));
426 menuFile
->Append(HelpDemo_MS_Html_Help_Help
, wxT("MS HTML &About Help Demo..."));
427 menuFile
->Append(HelpDemo_MS_Html_Help_Search
, wxT("MS HTML &Search help..."));
430 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
431 menuFile
->AppendSeparator();
432 menuFile
->Append(HelpDemo_Best_Help_Index
, wxT("Best &Help Index..."));
437 menuFile
->AppendSeparator();
438 menuFile
->Append(HelpDemo_Help_KDE
, wxT("Use &KDE"));
439 menuFile
->Append(HelpDemo_Help_GNOME
, wxT("Use &GNOME"));
440 menuFile
->Append(HelpDemo_Help_Netscape
, wxT("Use &Netscape"));
443 menuFile
->AppendSeparator();
444 menuFile
->Append(HelpDemo_Quit
, wxT("E&xit"));
446 // now append the freshly created menu to the menu bar...
447 wxMenuBar
*menuBar
= new wxMenuBar
;
448 menuBar
->Append(menuFile
, wxT("&File"));
450 // ... and attach this menu bar to the frame
454 // create a status bar just for fun (by default with 1 pane only)
456 SetStatusText(wxT("Welcome to wxWidgets!"));
457 #endif // wxUSE_STATUSBAR
460 // Create embedded HTML Help window
461 m_embeddedHelpWindow
= new wxHtmlHelpWindow
;
462 // m_embeddedHtmlHelp.UseConfig(config, rootPath); // Can set your own config object here
463 m_embeddedHtmlHelp
.SetHelpWindow(m_embeddedHelpWindow
);
465 m_embeddedHelpWindow
->Create(this,
466 wxID_ANY
, wxDefaultPosition
, GetClientSize(), wxTAB_TRAVERSAL
|wxNO_BORDER
, wxHF_DEFAULT_STYLE
);
468 m_embeddedHtmlHelp
.AddBook(wxFileName(wxT("doc.zip")));
469 m_embeddedHtmlHelp
.Display(wxT("Introduction"));
471 // now create some controls
473 // a panel first - if there were several controls, it would allow us to
474 // navigate between them from the keyboard
475 wxPanel
*panel
= new wxPanel(this, 301, wxPoint(0, 0), wxSize(400, 200));
476 panel
->SetHelpText(_("This panel just holds a static text control."));
477 //panel->SetHelpText(wxContextId(300));
479 // and a static control whose parent is the panel
480 wxStaticText
* staticText
= new wxStaticText(panel
, 302, wxT("Hello, world!"), wxPoint(10, 10));
481 staticText
->SetHelpText(_("This static text control isn't doing a lot right now."));
488 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
))
490 // true is to force the frame to close
494 void MyFrame::OnHelp(wxCommandEvent
& event
)
496 ShowHelp(event
.GetId(), m_help
);
499 void MyFrame::OnShowContextHelp(wxCommandEvent
& WXUNUSED(event
))
501 // This starts context help mode, then the user
502 // clicks on a window to send a help message
503 wxContextHelp
contextHelp(this);
506 void MyFrame::OnShowDialogContextHelp(wxCommandEvent
& WXUNUSED(event
))
508 MyModalDialog
dialog(this);
512 void MyFrame::OnAdvancedHtmlHelp(wxCommandEvent
& event
)
515 ShowHelp(event
.GetId(), m_advancedHtmlHelp
);
519 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
520 void MyFrame::OnMSHtmlHelp(wxCommandEvent
& event
)
522 ShowHelp(event
.GetId(), m_msHtmlHelp
);
526 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
527 void MyFrame::OnBestHelp(wxCommandEvent
& event
)
529 ShowHelp(event
.GetId(), m_bestHelp
);
534 void MyFrame::OnModalHtmlHelp(wxCommandEvent
& WXUNUSED(event
))
536 wxHtmlModalHelp
modalHelp(this, wxT("doc.zip"), wxT("Introduction"));
541 Notes: ShowHelp uses section ids for displaying particular topics,
542 but you might want to use a unique keyword to display a topic, instead.
544 Section ids are specified as follows for the different formats.
548 The [MAP] section specifies the topic to integer id mapping, e.g.
556 The identifier name corresponds to the label used for that topic.
557 You could also put these in a .h file and #include it in both the MAP
558 section and your C++ source.
560 Note that Tex2RTF doesn't currently generate the MAP section automatically.
564 The [MAP] section specifies the HTML filename root to integer id mapping, e.g.
572 The identifier name corresponds to the HTML filename used for that topic.
573 You could also put these in a .h file and #include it in both the MAP
574 section and your C++ source.
576 Note that Tex2RTF doesn't currently generate the MAP section automatically.
578 Simple wxHTML Help and External HTML Help
580 A wxhelp.map file is used, for example:
582 0 wx.htm ; wxWidgets: Help index; additional keywords like overview
583 1 wx204.htm ; wxWidgets Function Reference
584 2 wx34.htm ; wxWidgets Class Reference
586 Note that Tex2RTF doesn't currently generate the MAP section automatically.
590 An extension to the .hhc file format is used, specifying a new parameter
593 <OBJECT type="text/sitemap">
594 <param name="Local" value="doc2.htm#classes">
595 <param name="Name" value="Classes">
596 <param name="ID" value=2>
599 Again, this is not generated automatically by Tex2RTF, though it could
600 be added quite easily.
602 Unfortunately adding the ID parameters appears to interfere with MS HTML Help,
603 so you should not try to compile a .chm file from a .hhc file with
604 this extension, or the contents will be messed up.
607 void MyFrame::ShowHelp(int commandId
, wxHelpControllerBase
& helpController
)
611 case HelpDemo_Help_Classes
:
612 case HelpDemo_Html_Help_Classes
:
613 case HelpDemo_Advanced_Html_Help_Classes
:
614 case HelpDemo_MS_Html_Help_Classes
:
615 case HelpDemo_Best_Help_Classes
:
616 helpController
.DisplaySection(2);
617 //helpController.DisplaySection("Classes"); // An alternative form for most controllers
620 case HelpDemo_Help_Functions
:
621 case HelpDemo_Html_Help_Functions
:
622 case HelpDemo_Advanced_Html_Help_Functions
:
623 case HelpDemo_MS_Html_Help_Functions
:
624 helpController
.DisplaySection(1);
625 //helpController.DisplaySection("Functions"); // An alternative form for most controllers
628 case HelpDemo_Help_Help
:
629 case HelpDemo_Html_Help_Help
:
630 case HelpDemo_Advanced_Html_Help_Help
:
631 case HelpDemo_MS_Html_Help_Help
:
632 case HelpDemo_Best_Help_Help
:
633 helpController
.DisplaySection(3);
634 //helpController.DisplaySection("About"); // An alternative form for most controllers
637 case HelpDemo_Help_Search
:
638 case HelpDemo_Html_Help_Search
:
639 case HelpDemo_Advanced_Html_Help_Search
:
640 case HelpDemo_MS_Html_Help_Search
:
641 case HelpDemo_Best_Help_Search
:
643 wxString key
= wxGetTextFromUser(wxT("Search for?"),
644 wxT("Search help for keyword"),
648 helpController
.KeywordSearch(key
);
652 case HelpDemo_Help_Index
:
653 case HelpDemo_Html_Help_Index
:
654 case HelpDemo_Advanced_Html_Help_Index
:
655 case HelpDemo_MS_Html_Help_Index
:
656 case HelpDemo_Best_Help_Index
:
657 helpController
.DisplayContents();
660 // These three calls are only used by wxExtHelpController
662 case HelpDemo_Help_KDE
:
663 helpController
.SetViewer(wxT("kdehelp"));
665 case HelpDemo_Help_GNOME
:
666 helpController
.SetViewer(wxT("gnome-help-browser"));
668 case HelpDemo_Help_Netscape
:
669 helpController
.SetViewer(wxT("netscape"), wxHELP_NETSCAPE
);
674 // ----------------------------------------------------------------------------
676 // Demonstrates context-sensitive help
677 // ----------------------------------------------------------------------------
679 BEGIN_EVENT_TABLE(MyModalDialog
, wxDialog
)
682 MyModalDialog::MyModalDialog(wxWindow
*parent
)
683 : wxDialog(parent
, wxID_ANY
, wxString(wxT("Modal dialog")))
685 // Add the context-sensitive help button on the caption for the platforms
686 // which support it (currently MSW only)
687 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP
);
690 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
691 wxBoxSizer
*sizerRow
= new wxBoxSizer(wxHORIZONTAL
);
693 wxButton
* btnOK
= new wxButton(this, wxID_OK
, wxT("&OK"));
694 btnOK
->SetHelpText(_("The OK button confirms the dialog choices."));
696 wxButton
* btnCancel
= new wxButton(this, wxID_CANCEL
, wxT("&Cancel"));
697 btnCancel
->SetHelpText(_("The Cancel button cancels the dialog."));
699 sizerRow
->Add(btnOK
, 0, wxALIGN_CENTER
| wxALL
, 5);
700 sizerRow
->Add(btnCancel
, 0, wxALIGN_CENTER
| wxALL
, 5);
702 // Add explicit context-sensitive help button for non-MSW
704 sizerRow
->Add(new wxContextHelpButton(this), 0, wxALIGN_CENTER
| wxALL
, 5);
707 wxTextCtrl
*text
= new wxTextCtrl(this, wxID_ANY
, wxT("A demo text control"),
708 wxDefaultPosition
, wxSize(300, 100),
710 text
->SetHelpText(_("Type text here if you have got nothing more interesting to do"));
711 sizerTop
->Add(text
, 0, wxEXPAND
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5 );
712 sizerTop
->Add(sizerRow
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5 );
714 SetSizerAndFit(sizerTop
);