OnSelect event does not work with TTMSFNCSearchEdit when using the Enter button and ItemIndex is not set right with the Enter button

If you drop a TTMSFNCSearchEdit on a form and define an OnSelect event, it is working when you select with the mouse. However if you type a C and then the Enter button, the "Item C" has been selected, but it didn't fire the OnSelect event. Also the ItemIndex equals 0. However "Item A" has not been selected.

It would be more logical if ItemIndex corresponds with the item, when then text in the edit box equals an item in the SearchList.

We have fixed the OnSelect event not being triggered. There is no ItemIndex property at search edit level, so I suppose you are using the internal SearchList ItemIndex ?

Thank you for fixing the OnSelect event.

Yes, I am using the SearchList ItemIndex. The Edit and SearchList are combined in this component. So I think it is better if the text in the Edit equals to an item in the SearchList, that ItemIndex is set to that item. Just like a ComboBox.

I am sorry to tell, but the OnSelect event is still not fired.

If you drop a TTMSFNCSearchEdit on a form and define an OnSelect event, it is working when you select with the mouse. However if you type a C and then the Enter button, the "Item C" has been selected, but it didn't fire the OnSelect event.

Also the ItemIndex of the SearchList still not works like it should. For instance with the simple demo above:

  1. Select Item C: ItemIndex equals 2 like it should
  2. Type a 1 behind the C
  3. Erase the 1 (Item C will show up again in the list, but it won't be selected, However ItemIndex is still 2)
  4. Press "Arrow Up" and you will get an out of range error because ItemIndex is still 2 and the procedure SelectPreviousItem will have a FDisplayList with only 1 item (Item C).

I think ItemIndex should be -1 if the edit is used by the user, so when FDisplayList of the SearchList could be changing. When an Item in the SearchList is selected by the mouse, Enter, arrow or other keys, ItemIndex should be set to the corresponding item. However if FilterCondition.AutoSelect is set to true, ItemIndex should be set if there is a match with the filter.

Also the name of the procedure DisplayToItemIndex could be confusing. DisplayToSearchItemIndex would be better. ItemIndex is (almost) always the index of DisplayList. Not always like in DoItemClick and DoItemChange. Also better to use SearchItemIndex there, because it is the index of the SearchList and not the DisplayList.

If you need any help, just let me know. There are more things to improve, like GetRowIndex which is always used in the visual part of the DisplayList. However the search of the row index always starts at 0 (could be not visible), so it will be slow with a large DisplayList. If you use this method in a MouseMove event, you will see the slow response when you move the mouse in the end of the list.