All we know the famous NotInList event of combo box in world of VB6 , VB.net and MS-Access.
Its surprising how Delphi Rad Studio does not provide this IMPORTANT frequently requested feature in their combo box and similar controls?
How to efficiently implement this in Delphi ( using Data aware combo box linked to FireDac dataset)?
We in our Application use a primitive solution as in the following:
In OnExit combo box event , we search for the .Text in associated Dataset.
if we don't find it, we show message to the user: (Item Not found in List, add it now?)
if user choose OK then we add the new item and refresh the dataset and update combo box items.
Is their more efficient way to do this?
Thanks.
I'm trying to get the DevExpress grid view extension working using custom data binding with an existing ASP.NET MVC 3 site. I've read through and followed the steps in this guide in the DevExpress documentation, but when I try to page, sort or filter, the column information in the GridViewPagerState or GridViewColumnState objects that are bound to the callbacks used to handle these operations come back with default (blank) column information.
I can run the "simple custom data binding" and "advanced custom data binding" demos from the demo center application - these both work as expected. When I transplant the code into my application though, it doesn't work.
How can I get past this?
It turns out I was missing the setup of the DevExpressEditorsBinder in my Global.asax.cs file. Unfortunately I skimmed over this highlighted note taken from the Custom Data Binding - Overview:
Note
When implementing the grid's custom data binding, the DevExpressEditorsBinder must be used instead of the default model binder to correctly transfer values from DevExpress editors back to the corresponding data model fields. See the Binding to Model section in the Binding Data Editors to Data topic for more details on how to specify DevExpressEditorsBinder as a model binder.
Everyone probably knows what I mean, but to clarify the control would need to:
Fire an event when user edits the text. The event would provide a SuggestionList: TStrings which you could fill with matches/suggestions.
if the SuggestionList is not empty a drop down should appear.
Unlike combo, the control should not attempt to automatically select/auto complete or otherwise affect the editing.
So, is there a Delphi edit/combo control that works like that ?
Use the autocompletion feature built in to all Windows edit controls.
First, fill your TStrings object however you want. Then use GetOleStrings to create a TStringsAdapter to wrap it. (The adapter does not claim ownership of the TStrings object, so you must make sure you don't destroy it while the adapter is still live.) The adapter gives you an IStrings interface, which you'll need because the autocompletion feature requires an IEnumString interface to provide the completion matches. Call _NewEnum for that.
Next, call CoCreateInstance to create an IAutoComplete object. Call its Init method to associate it with the window handle of your edit control. If you're using a combo box, then send it a cbem_GetEditControl message to find the underlying edit window.
You can stop at that point and autocompletion should work automatically. You can disable autocompletion if you want, or you can set any number of autocompletion options.
You say you don't want autocompletion, but in the OS terminology, I think what you really don't want is called auto append, where the remainder of the string is entered into the edit box automatically as the user types, but selected so that further typing will overwrite it, and the user needs to delete the excess text if the desired value is shorter than one of the matches.
There is also auto suggest, which displays a drop-down list of suggestions.
You can enable either or both options. You don't need to filter the list of suggestions yourself; the autocomplete object filters the IEnumString list by itself.
You can use standard TComboBox and faststrings library (for stringMatches() function).
procedure TForm1.cbChange(Sender: TObject);
var
s:Integer;
tmpstr:string;
begin
//suggestions: tstringlist
cb.AutoComplete:=false;
tmpstr:=cb.Text;
cb.Items.Clear;
for s:=0 to suggestions.Count - 1 do
if StringMatches(suggestions[s],cb.Text+'*') then
cb.Items.Add(suggestions[s]);
cb.DroppedDown:=(cb.Items.Count<>0) and (Length(cb.Text)<>0);
cb.Text:=tmpstr;
cb.SelStart:=Length(cb.Text)
end;
If you just want to show a file or url list:
SHAutoComplete(GetWindow(eb_MyComboBox->Handle, GW_CHILD), SHACF_AUTOSUGGEST_FORCE_ON | SHACF_FILESYS_DIRS);
I first implemented this feature like Rob described it in his answer. Later I saw that TComboBoxEx has the property AutoCompleteOptions where I set acoAutoSuggest to True and acoAutoAppend to False. The ComboBox now filters its item list when doing some entry and shows the matching items.
I'm using RAD Studio 10 Seattle and XE2 but don't know if this feature is available in older versions.
To the last bit of your question: "So, is there a Delphi edit/combo control that works like that ?":
A bit late to the party but yes, I have written a free and open source component that implements the Google Place Autocomplete and Google Place Details API's:
It does inherit from the standard TComboBox but you can modify the code to work with any TEdit
https://carbonsoft.co.za/components/
or
https://github.com/RynoCoetzee/TRCGPlaceAutoCompleteCombo
I have a site with two languages, en-GB and fr-FR. my site structure is as follows
Home
---en
------subpages
---fr
------subpages
i want to implement a Language selector so that a user can also select on the page he wants this page in English or French, any ideas how to implement that. i am using Umbraco 5
Regards n Thanks,
Sher
I thinks the best way to do it is to add to your document type a property (possibly dropdownlist data type), which will hold a special keyword for each document. For Instance:
create a doc type with property "keyword", that will be a master doctype for the rest of your document and when you create a new document, set the keyword to be whatever you want. Then you can search for the wanted page and navigate according to the keyword.
Some constructors of WinRT types accept an IEnumerable<string> of languages to try in resolving a choice of language. For example, there is a Windows.Globalization.NumberFormatting.CurrencyFormatter constructor that takes a list of languages to try in determining the choice of language of the currency formatter.
The only method I know of to access the user's language is to default-construct a Windows.Globalization.Language object and access the Id property. If the user has set a list of preferred languages, how is it possible to obtain the full list in the priority order that they specified?
I think this property is what you need: GlobalizationPreferences.Languages. See the MSDN page on the GlobalizationPreferences class for more info.