[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] help implementation

From: Vaclav Slavik
Subject: Re: [lmi] help implementation
Date: Mon, 25 Feb 2008 19:06:33 +0100
User-agent: KMail/1.9.9

Greg Chicares wrote:
> I'm intrigued by your last sentence. Is there a simple change to
> the following little piece of XRC that would let me see for myself
> exactly what it means?

Not in this piece, because wxStaticText is not focusable, but you can 
add help popup to the associated control ("Comments" wxTextCtrl) by 
including <help> element in its definition, as in this diff:

@@ -236,6 +236,7 @@
             <object class="wxTextCtrl" name="Comments">
+                <help>Comments help placeholder</help>
         <object class="sizeritem">

Then you have to initialize a help provider in Skeleton::OnInit():

--- main_wx.cpp 24 Feb 2008 17:11:24 -0000      1.96
+++ main_wx.cpp 25 Feb 2008 17:55:39 -0000
@@ -83,6 +83,7 @@
 #include "wx_utility.hpp"           // class ClipboardEx

 #include <wx/config.h>
+#include <wx/cshelp.h>
 #include <wx/docmdi.h>
 #include <wx/image.h>
 #include <wx/log.h>                 // wxSafeShowMessage()
@@ -558,6 +559,9 @@


+        // for context-sensitive help
+        wxHelpProvider::Set(new wxSimpleHelpProvider);
         wxXmlResource& xml_resources = *wxXmlResource::Get();


(wxSimpleHelpProvider is "simple", because it doesn't interface any 
external help files and only uses contextual help strings provided by 
wxWindow::SetHelpText() calls or <help> elements in XRC.)

And that's it, pressing F1 when the text control has focus now shows 
the popup. If you use <help> for controls inside a dialog, the dialog 
should also use


to add the [?] button to its titlebar, but it's not strictly required.


PGP key: 0x465264C9, available from http://pgp.mit.edu/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]