Reputation: 5867
In CSS, you can change the effect of focusing on something using:
.myelement:focus { ... }
While in Cocoa, the text fields always have an ugly blue glow. How do I change the effect of focusing on an NSTextField (or not have it do anything at all)?
Upvotes: 7
Views: 3973
Reputation: 61238
The Cocoa equivalent of the command above would be:
[[textField window] makeFirstResponder:textField];
As to changing the appearance, are you asking how to change it for all controls in all applications ("globally") or just for a text field in your own app? There's no API for a global change, so system hacks are your only avenue. Good luck.
For controls you own (those that belong to your own application), you can set the focus ring type in Interface Builder or by code at runtime like this:
[textField setFocusRingType:NSFocusRingTypeNone];
// (or NSFocusRingTypeDefault or NSFocusRingTypeExterior)
Upvotes: 16