Added support for 'AutoComplete' attribute, automatically used by any wxTextCtrl-based property editor

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59429 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2009-03-08 11:34:01 +00:00
parent bd6ffa9f2b
commit 66fb9e1241
4 changed files with 45 additions and 8 deletions

View File

@@ -1633,12 +1633,12 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos,
int maxLen )
{
wxWindowID id = wxPG_SUBID1;
wxPGProperty* selected = m_selected;
wxASSERT(selected);
wxPGProperty* prop = m_selected;
wxASSERT(prop);
int tcFlags = wxTE_PROCESS_ENTER | extraStyle;
if ( selected->HasFlag(wxPG_PROP_READONLY) )
if ( prop->HasFlag(wxPG_PROP_READONLY) )
tcFlags |= wxTE_READONLY;
wxPoint p(pos.x,pos.y);
@@ -1675,14 +1675,12 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos,
SetupTextCtrlValue(value);
tc->Create(ctrlParent,id,value, p, s,tcFlags);
wxWindow* ed = tc;
// Center the control vertically
if ( !hasSpecialSize )
FixPosForTextCtrl(ed);
FixPosForTextCtrl(tc);
#ifdef __WXMSW__
ed->Show();
tc->Show();
if ( secondary )
secondary->Show();
#endif
@@ -1691,7 +1689,14 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos,
if ( maxLen > 0 )
tc->SetMaxLength( maxLen );
return (wxWindow*) ed;
wxVariant attrVal = prop->GetAttribute(wxPG_ATTR_AUTOCOMPLETE);
if ( !attrVal.IsNull() )
{
wxASSERT(attrVal.GetType() == wxS("arrstring"));
tc->AutoComplete(attrVal.GetArrayString());
}
return tc;
}
// -----------------------------------------------------------------------