I add
if key:=#13 then
do something

if i type something from the items of component then works fine , if i am trying to write a new string then the dropdown menu stays open and empty and the enter not work. You have to make a click with mouse and then press again enter to make the procedure.

I retested this here with:

procedure TForm1.AdvSearchComboBox1KeyPress(Sender: TObject; var Key: Char);
if key=#13 then

and I cannot see a problem. The Text is added as new item in the list.

check this video. Doesnt send activecontrol to next edit because still stays open empty dropdown menu.
There is no need to add it inside. If i have it take the data on keypress #13 or i use the new word as new entry for my form.

It is not the default behavior that pressing the return key will move the focus to the next control.
Did you add code to do this somehow?
If you want to move the focus also to the next control when you added a new entry, add code to move the focus to the TAdvSearchComboBox.OnKeypress handler.

Ι used code on keypress like this
If key=#13 then
// search the word add the data to cells i need and then activecontrol on next edit.
if you dont find the word in strings then dont add data i will do ti and activecontrol on next edit.

if find the word on strigns the key #13 works , if not find the word not work. This happends because not execute the onkeypress procedure. there is the bug.
if you watch the video i send , if the word you type is not on the strings of combobox , the box with strings still stays open with no words and not let onkeypress action. There is the bug.

I cannot reproduce this.
Test project attached. Please follow strategy as shown in the test project.
Project1.zip (52.2 KB)

edit1.setfocus made it work thanks.

I you change on your code edit1.setfocus with activecontrol:=edit1; works only when it finds string.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.