NSSearchField and Non-Alphanumeric Characters

AllanChin.6924AllanChin.6924 Allan ChinUSUniversity ✭✭✭
edited September 20 in Xamarin.Mac

I'm trying to implement a Search field in my Xamarin.Mac app and I started looking at this sample.

https://developer.xamarin.com/samples/mac/SearchField/

I edited the builtInKeywords list and filled them with IP addresses since that is what I want to search on. I have a bunch of 15.1..., 15.2..., and 192.168... addresses hard-coded. If I want to filter on "15.2" what I'm seeing is when I type "15" the list shows both "15.1..."s and "15.2..."s with the 1st address in the list selected. This is what I would expect. But as soon as type the ".", the search field auto-completes with the selected address and appends the "." at the end of it. Of course, what I would have like to have entered is "15.2" and see the list just show the "15.2..."s.

Playing around some more, it seems like any non-alphanumeric character does the same auto-complete and appends the non-alphanumeric character.

Is there an easy way I can stop that behavior so I can do what I want to do?

Thanks

I've attached my edited sample project.

Answers

  • ChrisHamonsChrisHamons Chris Hamons USXamarin Team Xamurai

    NSTextFieldDelegate has three new 10.12.2 APIs including ShouldSelectCandidate() that might allow you to customize the behavior.

Sign In or Register to comment.