Allow setting custom tooltip text for "New" button in wxPGArrayEditorDialog
Ability to change the tooltip can be useful if standard text "New item" is not descriptive enough.
This commit is contained in:
@@ -116,6 +116,8 @@ All (GUI):
|
||||
|
||||
- Fix wxInfoBar close button size in high DPI (Stefan Ziegler).
|
||||
- Make disabling the window before creating it actually work.
|
||||
- Allow changing tooltip text for button allowing to enter a new string
|
||||
in wxPGArrayEditorDialog.
|
||||
|
||||
|
||||
3.1.2: (released 2018-12-10)
|
||||
|
@@ -796,8 +796,7 @@ wxValidator* PROPNAME::DoGetValidator () const \
|
||||
|
||||
#if wxUSE_EDITABLELISTBOX
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxEditableListBox;
|
||||
class WXDLLIMPEXP_FWD_CORE wxListEvent;
|
||||
#include "wx/editlbox.h"
|
||||
|
||||
#define wxAEDIALOG_STYLE \
|
||||
(wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE)
|
||||
@@ -829,6 +828,15 @@ public:
|
||||
m_hasCustomNewAction = true;
|
||||
}
|
||||
|
||||
void SetNewButtonText(const wxString& text)
|
||||
{
|
||||
m_customNewButtonText = text;
|
||||
if ( m_elb && m_elb->GetNewButton() )
|
||||
{
|
||||
m_elb->GetNewButton()->SetToolTip(text);
|
||||
}
|
||||
}
|
||||
|
||||
// Set value modified by dialog.
|
||||
virtual void SetDialogValue( const wxVariant& WXUNUSED(value) )
|
||||
{
|
||||
@@ -880,6 +888,7 @@ protected:
|
||||
|
||||
bool m_modified;
|
||||
bool m_hasCustomNewAction;
|
||||
wxString m_customNewButtonText;
|
||||
|
||||
// These must be overridden - must return true on success.
|
||||
virtual wxString ArrayGet( size_t index ) = 0;
|
||||
@@ -929,6 +938,7 @@ public:
|
||||
if ( !custBtText.empty() )
|
||||
{
|
||||
EnableCustomNewAction();
|
||||
SetNewButtonText(custBtText);
|
||||
m_pCallingClass = pcc;
|
||||
}
|
||||
}
|
||||
|
@@ -727,6 +727,10 @@ public:
|
||||
|
||||
void EnableCustomNewAction();
|
||||
|
||||
/** Sets tooltip text for button allowing the user to enter new string.
|
||||
*/
|
||||
void SetNewButtonText(const wxString& text);
|
||||
|
||||
/** Set value modified by dialog.
|
||||
*/
|
||||
virtual void SetDialogValue( const wxVariant& value );
|
||||
|
@@ -2467,6 +2467,12 @@ bool wxPGArrayEditorDialog::Create( wxWindow *parent,
|
||||
wxEL_ALLOW_EDIT |
|
||||
wxEL_ALLOW_DELETE);
|
||||
|
||||
// Set custom text for "New" button, if provided
|
||||
if ( !m_customNewButtonText.empty() )
|
||||
{
|
||||
m_elb->GetNewButton()->SetToolTip(m_customNewButtonText);
|
||||
}
|
||||
|
||||
// Populate the list box
|
||||
wxArrayString arr;
|
||||
for ( unsigned int i=0; i<ArrayGetCount(); i++ )
|
||||
|
Reference in New Issue
Block a user