1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxHelpController demo
4 // Author: Karsten Ballueder
7 // Copyright: (c) Karsten Ballueder, Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx/wx.h".
20 #include "wx/wxprec.h"
26 // for all others, include the necessary headers (this file is usually all you
27 // need because it includes almost all "standard" wxWidgets headers
32 # include "wx/image.h"
34 # include "wx/cshelp.h"
37 # include "wx/tooltip.h"
40 // define this to 1 to use HTML help even under Windows (by default, Windows
41 // version will use WinHelp).
42 // Please also see samples/html/helpview.
43 #define USE_HTML_HELP 1
45 // define this to 1 to use external help controller (not used by default)
46 #define USE_EXT_HELP 0
48 // Define this to 0 to use the help controller as the help
49 // provider, or to 1 to use the 'simple help provider'
50 // (the one implemented with wxTipWindow).
51 #define USE_SIMPLE_HELP_PROVIDER 0
55 #define USE_HTML_HELP 0
59 #include "wx/filesys.h"
60 #include "wx/fs_zip.h"
62 #include "wx/html/helpctrl.h"
65 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
66 #include "wx/msw/helpchm.h"
69 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
70 #include "wx/msw/helpbest.h"
74 #include "wx/generic/helpext.h"
77 // ----------------------------------------------------------------------------
79 // ----------------------------------------------------------------------------
80 // the application icon
81 #ifndef wxHAS_IMAGES_IN_RESOURCES
82 #include "../sample.xpm"
85 // ----------------------------------------------------------------------------
87 // ----------------------------------------------------------------------------
89 // Define a new application type, each program should derive a class from wxApp
90 class MyApp
: public wxApp
93 // override base class virtuals
94 // ----------------------------
96 // this one is called on application startup and is a good place for the app
97 // initialization (doing it here and not in the ctor allows to have an error
98 // return: if OnInit() returns false, the application terminates)
99 virtual bool OnInit();
101 // do some clean up here
102 virtual int OnExit();
105 // Define a new frame type: this is going to be our main frame
106 class MyFrame
: public wxFrame
110 MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
);
112 wxHelpControllerBase
& GetHelpController() { return m_help
; }
115 wxHtmlHelpController
& GetAdvancedHtmlHelpController() { return m_advancedHtmlHelp
; }
117 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
118 wxCHMHelpController
& GetMSHtmlHelpController() { return m_msHtmlHelp
; }
120 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
121 wxBestHelpController
& GetBestHelpController() { return m_bestHelp
; }
124 // event handlers (these functions should _not_ be virtual)
125 void OnQuit(wxCommandEvent
& event
);
126 void OnHelp(wxCommandEvent
& event
);
127 void OnAdvancedHtmlHelp(wxCommandEvent
& event
);
128 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
129 void OnMSHtmlHelp(wxCommandEvent
& event
);
131 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
132 void OnBestHelp(wxCommandEvent
& event
);
135 void OnModalHtmlHelp(wxCommandEvent
& event
);
138 void OnShowContextHelp(wxCommandEvent
& event
);
139 void OnShowDialogContextHelp(wxCommandEvent
& event
);
141 void ShowHelp(int commandId
, wxHelpControllerBase
& helpController
);
145 wxExtHelpController m_help
;
147 wxHelpController m_help
;
151 wxHtmlHelpController m_advancedHtmlHelp
;
152 wxHtmlHelpController m_embeddedHtmlHelp
;
153 wxHtmlHelpWindow
* m_embeddedHelpWindow
;
156 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
157 wxCHMHelpController m_msHtmlHelp
;
160 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
161 wxBestHelpController m_bestHelp
;
164 // any class wishing to process wxWidgets events must use this macro
165 DECLARE_EVENT_TABLE()
168 // A custom modal dialog
169 class MyModalDialog
: public wxDialog
172 MyModalDialog(wxWindow
*parent
);
176 DECLARE_EVENT_TABLE()
179 // ----------------------------------------------------------------------------
181 // ----------------------------------------------------------------------------
183 // IDs for the controls and the menu commands
189 HelpDemo_Help_Classes
,
190 HelpDemo_Help_Functions
,
192 HelpDemo_Help_Search
,
193 HelpDemo_Help_ContextHelp
,
194 HelpDemo_Help_DialogContextHelp
,
196 HelpDemo_Html_Help_Index
,
197 HelpDemo_Html_Help_Classes
,
198 HelpDemo_Html_Help_Functions
,
199 HelpDemo_Html_Help_Help
,
200 HelpDemo_Html_Help_Search
,
202 HelpDemo_Advanced_Html_Help_Index
,
203 HelpDemo_Advanced_Html_Help_Classes
,
204 HelpDemo_Advanced_Html_Help_Functions
,
205 HelpDemo_Advanced_Html_Help_Help
,
206 HelpDemo_Advanced_Html_Help_Search
,
207 HelpDemo_Advanced_Html_Help_Modal
,
209 HelpDemo_MS_Html_Help_Index
,
210 HelpDemo_MS_Html_Help_Classes
,
211 HelpDemo_MS_Html_Help_Functions
,
212 HelpDemo_MS_Html_Help_Help
,
213 HelpDemo_MS_Html_Help_Search
,
215 HelpDemo_Best_Help_Index
,
216 HelpDemo_Best_Help_Classes
,
217 HelpDemo_Best_Help_Functions
,
218 HelpDemo_Best_Help_Help
,
219 HelpDemo_Best_Help_Search
,
223 HelpDemo_Help_Netscape
,
224 // controls start here (the numbers are, of course, arbitrary)
228 // ----------------------------------------------------------------------------
229 // event tables and other macros for wxWidgets
230 // ----------------------------------------------------------------------------
232 // the event tables connect the wxWidgets events with the functions (event
233 // handlers) which process them. It can be also done at run-time, but for the
234 // simple menu events like this the static method is much simpler.
235 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
236 EVT_MENU(HelpDemo_Quit
, MyFrame::OnQuit
)
237 EVT_MENU(HelpDemo_Help_Index
, MyFrame::OnHelp
)
238 EVT_MENU(HelpDemo_Help_Classes
, MyFrame::OnHelp
)
239 EVT_MENU(HelpDemo_Help_Functions
, MyFrame::OnHelp
)
240 EVT_MENU(HelpDemo_Help_Help
, MyFrame::OnHelp
)
241 EVT_MENU(HelpDemo_Help_Search
, MyFrame::OnHelp
)
242 EVT_MENU(HelpDemo_Help_ContextHelp
, MyFrame::OnShowContextHelp
)
243 EVT_MENU(HelpDemo_Help_DialogContextHelp
, MyFrame::OnShowDialogContextHelp
)
245 EVT_MENU(HelpDemo_Advanced_Html_Help_Index
, MyFrame::OnAdvancedHtmlHelp
)
246 EVT_MENU(HelpDemo_Advanced_Html_Help_Classes
, MyFrame::OnAdvancedHtmlHelp
)
247 EVT_MENU(HelpDemo_Advanced_Html_Help_Functions
, MyFrame::OnAdvancedHtmlHelp
)
248 EVT_MENU(HelpDemo_Advanced_Html_Help_Help
, MyFrame::OnAdvancedHtmlHelp
)
249 EVT_MENU(HelpDemo_Advanced_Html_Help_Search
, MyFrame::OnAdvancedHtmlHelp
)
251 EVT_MENU(HelpDemo_Advanced_Html_Help_Modal
, MyFrame::OnModalHtmlHelp
)
254 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
255 EVT_MENU(HelpDemo_MS_Html_Help_Index
, MyFrame::OnMSHtmlHelp
)
256 EVT_MENU(HelpDemo_MS_Html_Help_Classes
, MyFrame::OnMSHtmlHelp
)
257 EVT_MENU(HelpDemo_MS_Html_Help_Functions
, MyFrame::OnMSHtmlHelp
)
258 EVT_MENU(HelpDemo_MS_Html_Help_Help
, MyFrame::OnMSHtmlHelp
)
259 EVT_MENU(HelpDemo_MS_Html_Help_Search
, MyFrame::OnMSHtmlHelp
)
262 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
263 EVT_MENU(HelpDemo_Best_Help_Index
, MyFrame::OnBestHelp
)
266 EVT_MENU(HelpDemo_Help_KDE
, MyFrame::OnHelp
)
267 EVT_MENU(HelpDemo_Help_GNOME
, MyFrame::OnHelp
)
268 EVT_MENU(HelpDemo_Help_Netscape
, MyFrame::OnHelp
)
271 // Create a new application object: this macro will allow wxWidgets to create
272 // the application object during program execution (it's better than using a
273 // static object for many reasons) and also declares the accessor function
274 // wxGetApp() which will return the reference of the right type (i.e. MyApp and
278 // ============================================================================
280 // ============================================================================
282 // ----------------------------------------------------------------------------
283 // the application class
284 // ----------------------------------------------------------------------------
286 // `Main program' equivalent: the program execution "starts" here
289 if ( !wxApp::OnInit() )
292 // Create a simple help provider to make SetHelpText() do something.
293 // Note that this must be set before any SetHelpText() calls are made.
294 #if USE_SIMPLE_HELP_PROVIDER
295 wxSimpleHelpProvider
* provider
= new wxSimpleHelpProvider
;
297 wxHelpControllerHelpProvider
* provider
= new wxHelpControllerHelpProvider
;
299 wxHelpProvider::Set(provider
);
303 // Required for images in the online documentation
304 wxImage::AddHandler(new wxGIFHandler
);
307 // Required for advanced HTML help
308 #if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
309 wxFileSystem::AddHandler(new wxZipFSHandler
);
313 // Create the main application window
314 MyFrame
*frame
= new MyFrame(wxT("HelpDemo wxWidgets App"),
315 wxPoint(50, 50), wxSize(450, 340));
317 #if !USE_SIMPLE_HELP_PROVIDER
318 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
319 provider
->SetHelpController(& frame
->GetMSHtmlHelpController());
321 provider
->SetHelpController(& frame
->GetHelpController());
323 #endif // !USE_SIMPLE_HELP_PROVIDER
327 // initialise the help system: this means that we'll use doc.hlp file under
328 // Windows and that the HTML docs are in the subdirectory doc for platforms
330 if ( !frame
->GetHelpController().Initialize(wxT("doc")) )
332 wxLogError(wxT("Cannot initialize the help system, aborting."));
337 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
338 if( !frame
->GetMSHtmlHelpController().Initialize(wxT("doc")) )
340 wxLogError(wxT("Cannot initialize the MS HTML Help system."));
344 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
345 // you need to call Initialize in order to use wxBestHelpController
346 if( !frame
->GetBestHelpController().Initialize(wxT("doc")) )
348 wxLogError(wxT("Cannot initialize the best help system, aborting."));
353 // initialise the advanced HTML help system: this means that the HTML docs are in .htb
355 if ( !frame
->GetAdvancedHtmlHelpController().Initialize(wxT("doc")) )
357 wxLogError(wxT("Cannot initialize the advanced HTML help system, aborting."));
364 // defined(__WXMSW__) && wxUSE_MS_HTML_HELP
365 wxString
path(wxGetCwd());
366 if ( !frame
->GetMSHtmlHelpController().Initialize(path
+ wxT("\\doc.chm")) )
368 wxLogError("Cannot initialize the MS HTML help system, aborting.");
380 delete wxHelpProvider::Set(NULL
);
385 // ----------------------------------------------------------------------------
387 // ----------------------------------------------------------------------------
390 MyFrame::MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
)
391 : wxFrame((wxFrame
*)NULL
, 300, title
, pos
, size
)
393 , m_embeddedHtmlHelp(wxHF_EMBEDDED
|wxHF_DEFAULT_STYLE
)
396 // set the frame icon
397 SetIcon(wxICON(sample
));
400 wxMenu
*menuFile
= new wxMenu
;
402 menuFile
->Append(HelpDemo_Help_Index
, wxT("&Help Index..."));
403 menuFile
->Append(HelpDemo_Help_Classes
, wxT("&Help on Classes..."));
404 menuFile
->Append(HelpDemo_Help_Functions
, wxT("&Help on Functions..."));
405 menuFile
->Append(HelpDemo_Help_ContextHelp
, wxT("&Context Help..."));
406 menuFile
->Append(HelpDemo_Help_DialogContextHelp
, wxT("&Dialog Context Help...\tCtrl-H"));
407 menuFile
->Append(HelpDemo_Help_Help
, wxT("&About Help Demo..."));
408 menuFile
->Append(HelpDemo_Help_Search
, wxT("&Search help..."));
410 menuFile
->AppendSeparator();
411 menuFile
->Append(HelpDemo_Advanced_Html_Help_Index
, wxT("Advanced HTML &Help Index..."));
412 menuFile
->Append(HelpDemo_Advanced_Html_Help_Classes
, wxT("Advanced HTML &Help on Classes..."));
413 menuFile
->Append(HelpDemo_Advanced_Html_Help_Functions
, wxT("Advanced HTML &Help on Functions..."));
414 menuFile
->Append(HelpDemo_Advanced_Html_Help_Help
, wxT("Advanced HTML &About Help Demo..."));
415 menuFile
->Append(HelpDemo_Advanced_Html_Help_Search
, wxT("Advanced HTML &Search help..."));
416 menuFile
->Append(HelpDemo_Advanced_Html_Help_Modal
, wxT("Advanced HTML Help &Modal Dialog..."));
419 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
420 menuFile
->AppendSeparator();
421 menuFile
->Append(HelpDemo_MS_Html_Help_Index
, wxT("MS HTML &Help Index..."));
422 menuFile
->Append(HelpDemo_MS_Html_Help_Classes
, wxT("MS HTML &Help on Classes..."));
423 menuFile
->Append(HelpDemo_MS_Html_Help_Functions
, wxT("MS HTML &Help on Functions..."));
424 menuFile
->Append(HelpDemo_MS_Html_Help_Help
, wxT("MS HTML &About Help Demo..."));
425 menuFile
->Append(HelpDemo_MS_Html_Help_Search
, wxT("MS HTML &Search help..."));
428 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
429 menuFile
->AppendSeparator();
430 menuFile
->Append(HelpDemo_Best_Help_Index
, wxT("Best &Help Index..."));
435 menuFile
->AppendSeparator();
436 menuFile
->Append(HelpDemo_Help_KDE
, wxT("Use &KDE"));
437 menuFile
->Append(HelpDemo_Help_GNOME
, wxT("Use &GNOME"));
438 menuFile
->Append(HelpDemo_Help_Netscape
, wxT("Use &Netscape"));
441 menuFile
->AppendSeparator();
442 menuFile
->Append(HelpDemo_Quit
, wxT("E&xit"));
444 // now append the freshly created menu to the menu bar...
445 wxMenuBar
*menuBar
= new wxMenuBar
;
446 menuBar
->Append(menuFile
, wxT("&File"));
448 // ... and attach this menu bar to the frame
452 // create a status bar just for fun (by default with 1 pane only)
454 SetStatusText(wxT("Welcome to wxWidgets!"));
455 #endif // wxUSE_STATUSBAR
458 // Create embedded HTML Help window
459 m_embeddedHelpWindow
= new wxHtmlHelpWindow
;
460 // m_embeddedHtmlHelp.UseConfig(config, rootPath); // Can set your own config object here
461 m_embeddedHtmlHelp
.SetHelpWindow(m_embeddedHelpWindow
);
463 m_embeddedHelpWindow
->Create(this,
464 wxID_ANY
, wxDefaultPosition
, GetClientSize(), wxTAB_TRAVERSAL
|wxNO_BORDER
, wxHF_DEFAULT_STYLE
);
466 m_embeddedHtmlHelp
.AddBook(wxFileName(wxT("doc.zip")));
467 m_embeddedHtmlHelp
.Display(wxT("Introduction"));
469 // now create some controls
471 // a panel first - if there were several controls, it would allow us to
472 // navigate between them from the keyboard
473 wxPanel
*panel
= new wxPanel(this, 301, wxPoint(0, 0), wxSize(400, 200));
474 panel
->SetHelpText(_("This panel just holds a static text control."));
475 //panel->SetHelpText(wxContextId(300));
477 // and a static control whose parent is the panel
478 wxStaticText
* staticText
= new wxStaticText(panel
, 302, wxT("Hello, world!"), wxPoint(10, 10));
479 staticText
->SetHelpText(_("This static text control isn't doing a lot right now."));
486 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
))
488 // true is to force the frame to close
492 void MyFrame::OnHelp(wxCommandEvent
& event
)
494 ShowHelp(event
.GetId(), m_help
);
497 void MyFrame::OnShowContextHelp(wxCommandEvent
& WXUNUSED(event
))
499 // This starts context help mode, then the user
500 // clicks on a window to send a help message
501 wxContextHelp
contextHelp(this);
504 void MyFrame::OnShowDialogContextHelp(wxCommandEvent
& WXUNUSED(event
))
506 MyModalDialog
dialog(this);
510 void MyFrame::OnAdvancedHtmlHelp(wxCommandEvent
& event
)
513 ShowHelp(event
.GetId(), m_advancedHtmlHelp
);
517 #if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
518 void MyFrame::OnMSHtmlHelp(wxCommandEvent
& event
)
520 ShowHelp(event
.GetId(), m_msHtmlHelp
);
524 #if wxUSE_MS_HTML_HELP && wxUSE_WXHTML_HELP && !defined(__WXUNIVERSAL__)
525 void MyFrame::OnBestHelp(wxCommandEvent
& event
)
527 ShowHelp(event
.GetId(), m_bestHelp
);
532 void MyFrame::OnModalHtmlHelp(wxCommandEvent
& WXUNUSED(event
))
534 wxHtmlModalHelp
modalHelp(this, wxT("doc.zip"), wxT("Introduction"));
539 Notes: ShowHelp uses section ids for displaying particular topics,
540 but you might want to use a unique keyword to display a topic, instead.
542 Section ids are specified as follows for the different formats.
546 The [MAP] section specifies the topic to integer id mapping, e.g.
554 The identifier name corresponds to the label used for that topic.
555 You could also put these in a .h file and #include it in both the MAP
556 section and your C++ source.
558 Note that Tex2RTF doesn't currently generate the MAP section automatically.
562 The [MAP] section specifies the HTML filename root to integer id mapping, e.g.
570 The identifier name corresponds to the HTML filename used for that topic.
571 You could also put these in a .h file and #include it in both the MAP
572 section and your C++ source.
574 Note that Tex2RTF doesn't currently generate the MAP section automatically.
576 Simple wxHTML Help and External HTML Help
578 A wxhelp.map file is used, for example:
580 0 wx.htm ; wxWidgets: Help index; additional keywords like overview
581 1 wx204.htm ; wxWidgets Function Reference
582 2 wx34.htm ; wxWidgets Class Reference
584 Note that Tex2RTF doesn't currently generate the MAP section automatically.
588 An extension to the .hhc file format is used, specifying a new parameter
591 <OBJECT type="text/sitemap">
592 <param name="Local" value="doc2.htm#classes">
593 <param name="Name" value="Classes">
594 <param name="ID" value=2>
597 Again, this is not generated automatically by Tex2RTF, though it could
598 be added quite easily.
600 Unfortunately adding the ID parameters appears to interfere with MS HTML Help,
601 so you should not try to compile a .chm file from a .hhc file with
602 this extension, or the contents will be messed up.
605 void MyFrame::ShowHelp(int commandId
, wxHelpControllerBase
& helpController
)
609 case HelpDemo_Help_Classes
:
610 case HelpDemo_Html_Help_Classes
:
611 case HelpDemo_Advanced_Html_Help_Classes
:
612 case HelpDemo_MS_Html_Help_Classes
:
613 case HelpDemo_Best_Help_Classes
:
614 helpController
.DisplaySection(2);
615 //helpController.DisplaySection("Classes"); // An alternative form for most controllers
618 case HelpDemo_Help_Functions
:
619 case HelpDemo_Html_Help_Functions
:
620 case HelpDemo_Advanced_Html_Help_Functions
:
621 case HelpDemo_MS_Html_Help_Functions
:
622 helpController
.DisplaySection(1);
623 //helpController.DisplaySection("Functions"); // An alternative form for most controllers
626 case HelpDemo_Help_Help
:
627 case HelpDemo_Html_Help_Help
:
628 case HelpDemo_Advanced_Html_Help_Help
:
629 case HelpDemo_MS_Html_Help_Help
:
630 case HelpDemo_Best_Help_Help
:
631 helpController
.DisplaySection(3);
632 //helpController.DisplaySection("About"); // An alternative form for most controllers
635 case HelpDemo_Help_Search
:
636 case HelpDemo_Html_Help_Search
:
637 case HelpDemo_Advanced_Html_Help_Search
:
638 case HelpDemo_MS_Html_Help_Search
:
639 case HelpDemo_Best_Help_Search
:
641 wxString key
= wxGetTextFromUser(wxT("Search for?"),
642 wxT("Search help for keyword"),
646 helpController
.KeywordSearch(key
);
650 case HelpDemo_Help_Index
:
651 case HelpDemo_Html_Help_Index
:
652 case HelpDemo_Advanced_Html_Help_Index
:
653 case HelpDemo_MS_Html_Help_Index
:
654 case HelpDemo_Best_Help_Index
:
655 helpController
.DisplayContents();
658 // These three calls are only used by wxExtHelpController
660 case HelpDemo_Help_KDE
:
661 helpController
.SetViewer(wxT("kdehelp"));
663 case HelpDemo_Help_GNOME
:
664 helpController
.SetViewer(wxT("gnome-help-browser"));
666 case HelpDemo_Help_Netscape
:
667 helpController
.SetViewer(wxT("netscape"), wxHELP_NETSCAPE
);
672 // ----------------------------------------------------------------------------
674 // Demonstrates context-sensitive help
675 // ----------------------------------------------------------------------------
677 BEGIN_EVENT_TABLE(MyModalDialog
, wxDialog
)
680 MyModalDialog::MyModalDialog(wxWindow
*parent
)
681 : wxDialog(parent
, wxID_ANY
, wxString(wxT("Modal dialog")))
683 // Add the context-sensitive help button on the caption for the platforms
684 // which support it (currently MSW only)
685 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP
);
688 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
689 wxBoxSizer
*sizerRow
= new wxBoxSizer(wxHORIZONTAL
);
691 wxButton
* btnOK
= new wxButton(this, wxID_OK
, wxT("&OK"));
692 btnOK
->SetHelpText(_("The OK button confirms the dialog choices."));
694 wxButton
* btnCancel
= new wxButton(this, wxID_CANCEL
, wxT("&Cancel"));
695 btnCancel
->SetHelpText(_("The Cancel button cancels the dialog."));
697 sizerRow
->Add(btnOK
, 0, wxALIGN_CENTER
| wxALL
, 5);
698 sizerRow
->Add(btnCancel
, 0, wxALIGN_CENTER
| wxALL
, 5);
700 // Add explicit context-sensitive help button for non-MSW
702 sizerRow
->Add(new wxContextHelpButton(this), 0, wxALIGN_CENTER
| wxALL
, 5);
705 wxTextCtrl
*text
= new wxTextCtrl(this, wxID_ANY
, wxT("A demo text control"),
706 wxDefaultPosition
, wxSize(300, 100),
708 text
->SetHelpText(_("Type text here if you have got nothing more interesting to do"));
709 sizerTop
->Add(text
, 0, wxEXPAND
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5 );
710 sizerTop
->Add(sizerRow
, 0, wxALIGN_RIGHT
|wxALIGN_CENTER_VERTICAL
|wxALL
, 5 );
712 SetSizerAndFit(sizerTop
);