Call SetToolTip() for the property editor control when wxPG_EX_HELP_AS_TOOLTIPS style is used

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2010-09-20 15:38:12 +00:00
parent 63dcc736df
commit b89b24691e

View File

@@ -4032,6 +4032,8 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
wxPrintf( "P = NULL\n" ); wxPrintf( "P = NULL\n" );
*/ */
wxWindow* primaryCtrl = NULL;
// If we are frozen, then just set the values. // If we are frozen, then just set the values.
if ( m_frozen ) if ( m_frozen )
{ {
@@ -4157,7 +4159,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
m_wndEditor = wndList.m_primary; m_wndEditor = wndList.m_primary;
m_wndEditor2 = wndList.m_secondary; m_wndEditor2 = wndList.m_secondary;
wxWindow* primaryCtrl = GetEditorControl(); primaryCtrl = GetEditorControl();
// //
// Essentially, primaryCtrl == m_wndEditor // Essentially, primaryCtrl == m_wndEditor
@@ -4285,6 +4287,13 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
ClearInternalFlag(wxPG_FL_IN_SELECT_PROPERTY); ClearInternalFlag(wxPG_FL_IN_SELECT_PROPERTY);
} }
const wxString* pHelpString = NULL;
if ( p )
pHelpString = &p->GetHelpString();
if ( !(GetExtraStyle() & wxPG_EX_HELP_AS_TOOLTIPS) )
{
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// //
@@ -4292,27 +4301,16 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
// (if found and grid not embedded in manager with help box and // (if found and grid not embedded in manager with help box and
// style wxPG_EX_HELP_AS_TOOLTIPS is not used). // style wxPG_EX_HELP_AS_TOOLTIPS is not used).
// //
if ( !(GetExtraStyle() & wxPG_EX_HELP_AS_TOOLTIPS) )
{
wxStatusBar* statusbar = GetStatusBar(); wxStatusBar* statusbar = GetStatusBar();
if ( statusbar ) if ( statusbar )
{ {
const wxString* pHelpString = (const wxString*) NULL; if ( pHelpString && pHelpString->length() )
if ( p )
{
pHelpString = &p->GetHelpString();
if ( pHelpString->length() )
{ {
// Set help box text. // Set help box text.
statusbar->SetStatusText( *pHelpString ); statusbar->SetStatusText( *pHelpString );
m_iFlags |= wxPG_FL_STRING_IN_STATUSBAR; m_iFlags |= wxPG_FL_STRING_IN_STATUSBAR;
} }
} else if ( m_iFlags & wxPG_FL_STRING_IN_STATUSBAR )
if ( (!pHelpString || !pHelpString->length()) &&
(m_iFlags & wxPG_FL_STRING_IN_STATUSBAR) )
{ {
// Clear help box - but only if it was written // Clear help box - but only if it was written
// by us at previous time. // by us at previous time.
@@ -4320,8 +4318,21 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
m_iFlags &= ~(wxPG_FL_STRING_IN_STATUSBAR); m_iFlags &= ~(wxPG_FL_STRING_IN_STATUSBAR);
} }
} }
#endif
}
else
{
#if wxPG_SUPPORT_TOOLTIPS
//
// Show help as a tool tip on the editor control.
//
if ( pHelpString && pHelpString->length() &&
primaryCtrl )
{
primaryCtrl->SetToolTip(*pHelpString);
} }
#endif #endif
}
// call wx event handler (here so that it also occurs on deselection) // call wx event handler (here so that it also occurs on deselection)
if ( !(flags & wxPG_SEL_DONT_SEND_EVENT) ) if ( !(flags & wxPG_SEL_DONT_SEND_EVENT) )