wxMaxima
Loading...
Searching...
No Matches
Functions
MenuHelpString.h File Reference

Declares MenuHelpString(), the safe menu-item help-text lookup used for the status bar. More...

#include <wx/string.h>
Include dependency graph for MenuHelpString.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

wxString MenuHelpString (wxMenu *menu, int id)
 Returns the help string of the item with the given id inside menu.
 

Detailed Description

Declares MenuHelpString(), the safe menu-item help-text lookup used for the status bar.

Function Documentation

◆ MenuHelpString()

wxString MenuHelpString ( wxMenu *  menu,
int  id 
)

Returns the help string of the item with the given id inside menu.

This is what wxMaxima shows in the status bar while a menu item is highlighted. It exists as a separate, testable function because wxMenu::GetHelpString() asserts ("item" failed) in wxWidgets 3.3 when the highlighted id is not an item of that menu – a situation the native menu code (notably on Windows) can produce for menu/submenu titles or ids that belong to another menu. Instead of relying on GetHelpString()'s not-found behaviour we look the item up with wxMenu::FindItem(), which recurses into submenus and simply returns nullptr when nothing matches.

Parameters
menuThe menu whose item is being highlighted (may be nullptr).
idThe highlighted item id (ids <= 0 are treated as "no item").
Returns
The item's help text, or an empty string when there is no matching item. Never asserts.