diff --git a/wxPython/demo/wxDialog.py b/wxPython/demo/wxDialog.py index 399ebe3c1e..7985b60dfd 100644 --- a/wxPython/demo/wxDialog.py +++ b/wxPython/demo/wxDialog.py @@ -1,25 +1,41 @@ from wxPython.wx import * +from wxPython.help import * #--------------------------------------------------------------------------- def runTest(frame, nb, log): - win = wxDialog(frame, -1, "This is a wxDialog", size=wxSize(350, 200), - style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME - #style = wxDEFAULT_DIALOG_STYLE +## win = wxDialog(frame, -1, "This is a wxDialog", size=wxSize(350, 200), +## style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME +## #style = wxDEFAULT_DIALOG_STYLE +## ) + + # Create and set a help provider. Normally you would do this in + # the app's OnInit as it must be done before any SetHelpText calls. + provider = wxSimpleHelpProvider() + wxHelpProvider_Set(provider) + + win = wxPreDialog() + win.SetExtraStyle(wxDIALOG_EX_CONTEXTHELP) + win.Create(frame, -1, "This is a wxDialog", size=wxSize(350, 200), + #style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME + style = wxDEFAULT_DIALOG_STYLE ) sizer = wxBoxSizer(wxVERTICAL) label = wxStaticText(win, -1, "This is a wxDialog") + label.SetHelpText("This is the help text for the label") sizer.Add(label, 0, wxALIGN_CENTRE|wxALL, 5) box = wxBoxSizer(wxHORIZONTAL) label = wxStaticText(win, -1, "Field #1:") + label.SetHelpText("This is the help text for the label") box.Add(label, 0, wxALIGN_CENTRE|wxALL, 5) text = wxTextCtrl(win, -1, "", size=(80,-1)) + text.SetHelpText("Here's some help text for field #1") box.Add(text, 1, wxALIGN_CENTRE|wxALL, 5) sizer.AddSizer(box, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5) @@ -27,9 +43,11 @@ def runTest(frame, nb, log): box = wxBoxSizer(wxHORIZONTAL) label = wxStaticText(win, -1, "Field #2:") + label.SetHelpText("This is the help text for the label") box.Add(label, 0, wxALIGN_CENTRE|wxALL, 5) text = wxTextCtrl(win, -1, "", size=(80,-1)) + text.SetHelpText("Here's some help text for field #2") box.Add(text, 1, wxALIGN_CENTRE|wxALL, 5) sizer.AddSizer(box, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5) @@ -41,9 +59,11 @@ def runTest(frame, nb, log): btn = wxButton(win, wxID_OK, " OK ") btn.SetDefault() + btn.SetHelpText("The OK button completes the dialog") box.Add(btn, 0, wxALIGN_CENTRE|wxALL, 5) btn = wxButton(win, wxID_CANCEL, " Cancel ") + btn.SetHelpText("The Cancel button cnacels the dialog. (Duh!)") box.Add(btn, 0, wxALIGN_CENTRE|wxALL, 5) sizer.AddSizer(box, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5)