## wxHelpProvider

wxHelpProvider is an abstract class used by a program implementing context-sensitive help to show the help text for the given window.

The current help provider must be explicitly set by the application using wxHelpProvider::Set().

Derived from

No base class

Include files

<wx/cshelp.h>

See also

wxContextHelp, wxContextHelpButton, wxSimpleHelpProvider, wxHelpControllerHelpProvider, wxWindow::SetHelpText, wxWindow::GetHelpTextAtPoint

Members

wxHelpProvider::~wxHelpProvider
wxHelpProvider::AddHelp
wxHelpProvider::Get
wxHelpProvider::GetHelp
wxHelpProvider::RemoveHelp
wxHelpProvider::Set
wxHelpProvider::ShowHelpAtPoint
wxHelpProvider::ShowHelp

### wxHelpProvider::~wxHelpProvider

~wxHelpProvider()

Virtual destructor for any base class.

### wxHelpProvider::AddHelp

virtual void AddHelp(wxWindowBase* window, const wxString& text)

Associates the text with the given window or id. Although all help providers have these functions to allow making wxWindow::SetHelpText work, not all of them implement the functions.

virtual void AddHelp(wxWindowID id, const wxString& text)

This version associates the given text with all windows with this id. May be used to set the same help string for all Cancel buttons in the application, for example.

### wxHelpProvider::Get

static wxHelpProvider* Get()

Returns pointer to help provider instance.

Unlike some other classes, the help provider is not created on demand. This must be explicitly done by the application using Set.

### wxHelpProvider::GetHelp

virtual wxString GetHelp(const wxWindowBase* window)

Gets the help string for this window. Its interpretation is dependent on the help provider except that empty string always means that no help is associated with the window.

### wxHelpProvider::RemoveHelp

virtual void RemoveHelp(wxWindowBase* window)

Removes the association between the window pointer and the help text, if it was previously set using AddHelp. This is called by the wxWindow destructor. Without this, the table of help strings will fill up and when window pointers are reused, the wrong help string will be found.

Note that this method may be called even for windows that don't have any associated help text. If that happens, its implementation should simply do nothing.

### wxHelpProvider::Set

static wxHelpProvider* Set(wxHelpProvider* helpProvider)

Get/set the current, application-wide help provider. Returns the previous one.

### wxHelpProvider::ShowHelpAtPoint

virtual bool ShowHelpAtPoint(wxWindowBase* window, const wxPoint point, wxHelpEvent::Origin origin)

This function may be overridden to show help for the window when it should depend on the position inside the window, By default this method forwards to ShowHelp, so it is enough to only implement the latter if the help doesn't depend on the position.

Returns `true` if help was shown, or `false` if no help was available for this window.

Parameters

window

Window to show help text for.

point

Coordinates of the mouse at the moment of help event emission.

origin

Help event origin, see wxHelpEvent::GetOrigin.

This function is new since wxWidgets version 2.7.0

### wxHelpProvider::ShowHelp

virtual bool ShowHelp(wxWindowBase* window)

Shows help for the given window. Override this function if the help doesn't depend on the exact position inside the window, otherwise you need to override ShowHelpAtPoint.

Returns `true` if help was shown, or `false` if no help was available for this window.