Question

I'm having a little problem with the NSTextfield of my program.
When I select them, they gain the focus ring or get a little darker (if the focus ring is disabled) but if I unselect them they are not redrawn correctly.

Image of this NSTextField problem

The first textfield was selected and keep it's darker color once unselected (focus ring disabled for this field).
The second textfield was selected but keep part of the focus ring once unselected (there are some part of the focus ring left on the other 2 textfields too).
The third textfield wasn't selected at all.

It looks like the border aren't refreshing correctly and calling needDisplay on the NSTextField doesn't seem to have any effect.

I'm only using NSTextfield (no subclass) from which I only change the font size (to Lucida Grande 11). I'm probably missing something obvious but I wasn't able to find the cause of this problem.

-- EDIT --

The only code I have related to these textfields are the "Sent Actions" and I'm only reading the content of these fields.
I tried to add a new NSTextfield, changed the properties to match the ones of these problematic textfields and it's actually working great except I can't manage to have the same rounded borders I had. Xcode is displaying them one way but when building and running the application it doesn't match what Xcode was showing.

When doing these first NSTextfields I played a little with Xcode settings for the view containing them.
I changed the Appearance from Inherited (Aqua) to Light Content which changed the look of the text fields and I think my view now has a mix of Aqua/Light Content appearances.

Could it be related to that appearance setting ?

Thanks, Thomas

Was it helpful?

Solution

I did some more tests creating a new empty project.
The "bug" is easily reproducible:
- create a new Cocoa Application
- add some NSTextField on the view of your main window
- change the appearance of the window to Light Content
- run the application

So I guess this is actually a bug and not really related to what I did.

Thanks for trying to help me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top