macoslib NSSearchField Refuses to deselect?

Hi,
I have dragged an NSSearchField onto my window, but when the app is run, the search field automatically gets activated (as if the user has clicked inside it, even though they haven’t).

Does anyone know how to prevent this?
At the moment, I have to click on a listbox or other control first, in order to deselect the NSSearch Field - really annoying!!

I have tried setting the focus to another control in the Window.Open event - to no avail.
I can find no info on the NSSearchField in the LR, and also cannot find out how to change the default “Search” word that appears inside the control.

Here are a couple of screenshots:
Screenshot of the default appearance

Screenshot of my settings for the control

Can anyone please point me in the right direction?

Thank you all in advance.

TextField steals focus, maybe a Timer helps ( mode - single, period 100)
Action - listbox.setfocus

CueText ?

Tried that - absolutely no change using a timer :frowning:
Any idea where the info for the NSSearchField is in the Language Reference?

I have looked under “N” and “S” - with no success.

Thanks.

Do you use the MacOSlib NSSearchField or the NSSearchField from jim mckay ?
Then it is not in the Language Reference.

I thought the NSSearchField was part of the new Xojo - hence why I was looking in the Language Reference. It must be part of macoslib then, and has been automatically added to the Library.

Very strange. If I click on a Listbox or a text area - the NSSearchField deselects. If I try to set focus to another control via code / timer - it does NOT deselect.

The NSSearchField works as expected in the toolbar, but not when placed in a window?

For me it works, but I use an adapted version of jim’s NSSearchField

Test

Maybe the macoslib NSSearchField is only meant to work in a toolbar?

No; that implementation is intended to work in a window. The new version of macoslib will have such controls with base implementation provided in a plugin, which should eliminate most hackery needed to get them to play well with the focus and such.

Bit confused now. I am using the latest version of macoslib - I downloaded it from GitHub about 2 days ago.
Someone else is having exactly the same problem as me, so this time it can’t actually be a problem with my code :slight_smile:

I just tried the MacOSLib version with a textField in the same window. As long as the textfield is above the NSSearchField in the window’s taborder it seems to not steal focus. ListBox fails though.

Thanks Jim - I will look into that.