2 Questions about/Bugs regarding NSSearchFields in MacOSLib

I am using many of the MacOSLib controls in my project.
Question 1: I have an NSSearchField placed into a canvas to group it with other controls so it can be placed in a NSPopover in my app. When the controls are added to the view of the Popover, all of the controls are placed correctly except for the NSSearchField, which puts itself in the bottom left corner of the Popover. If a second NSSearchField is added, then they are placed on top of each other at the bottom left of the Popover, which leads me to believe this is a bug/oversight. Has anyone found a way around this so that NNSearchFields are properly placed into a Popover?

Question 2: Has anyone found a way around the bug where a NSSearchField (or NSTextField) cannot be typed into when on a popover? There is a solution provided here, but I am not sure how I would implement this into Xojo. Any ideas? Thanks

Sample project so you don’t have to make one yourself. Thanks

  1. I believe MBS lets you implement a window’s canBecomeKeyWindow event. I don’t think macoslib has a mechanism for that, yet, though.

There is a “makeKeyWindow” method which i think does it, but I’m not sure yet. Still haven’t been able to figure out how to make the search field display correctly, I think I might have to move to a normal textfield that’s bezeled instead.

So I figured out a way to properly place the NSSearchField in the popover, it has to be placed into a ContainerControl. So question one is answered. Anyone have ideas on question two, how to make the NSPopover accept key events? Thanks

AFAIK, makeKeyWindow invokes canBecomeKeyWindow, and that usually returns false, so your call to makeKeyWindow won’t have any effect.

Ok thanks, didn’t realize that. I’ll have to see if I can’t figure out another way.