]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/propgrid/propgrid.cpp
Added support for 'AutoComplete' attribute, automatically used by any wxTextCtrl...
[wxWidgets.git] / samples / propgrid / propgrid.cpp
index 6a37ae4d25334c65de9fa167d1f7307508a4750c..56abbad6d29b28cc8038b8e0a8a9ee29f6030b69 100644 (file)
@@ -1531,6 +1531,25 @@ void FormMain::PopulateWithExamples ()
     // Set value after limiting so that it will be applied
     pg->SetPropertyValue( wxT("StringProperty"), wxT("some text") );
 
+    //
+    // Demonstrate "AutoComplete" attribute
+    pg->Append( new wxStringProperty( "StringProperty AutoComplete",
+                                      wxPG_LABEL ) );
+
+    wxArrayString autoCompleteStrings;
+    autoCompleteStrings.Add("One choice");
+    autoCompleteStrings.Add("Another choice");
+    autoCompleteStrings.Add("Another choice, yeah");
+    autoCompleteStrings.Add("Yet another choice");
+    autoCompleteStrings.Add("Yet another choice, bear with me");
+    pg->SetPropertyAttribute( "StringProperty AutoComplete",
+                              "AutoComplete",
+                              autoCompleteStrings );
+
+    pg->SetPropertyHelpString( "StringProperty AutoComplete",
+        "AutoComplete attribute has been set for this property "
+        "(try writing something beginning with 'a', 'o' or 'y').");
+
     // Add string property with arbitrarily wide bitmap in front of it. We
     // intentionally lower-than-typical row height here so that the ugly
     // scaling code wont't be run.