Cocoa: NSOutlineView not highlighted as blue bar - objective-c

I use the - addSubview: method to add an subview with outline view.
But I found strange that if I programmatically select an object of this outline view, the selection highlighting was not blue:
However, as long as I perform an mouse click on the outline view, its highlighting became normal:
Why did this happen? How can I make the highlighting drawn as blue before any mouse event?
Thank you at advance!

If the outline view doesn't have focus it will use the grey color. Make it first responder, to get focus, and the selection turns blue.
You can make it first responder for example by using NSWindows makeFirstResponder: :
[self.window makeFirstResponder:self.outlineView];

Related

Remove blue outline from NSSplitView's subviews

I have an NSSplitView, and each subview (left/right) seems to draw a bright blue outline around them when clicked. Each of these subviews is a NSScrollView
Is there a means of disabling this? I have dug through the docs to no avail.
Select the Attributes inspector and under the "View" category set Focus Ring property to none.
Make sure you do this to all views in the view hierarchy.

how to fill color throughout the NSTableHeaderView of view based NSoutlineview

i had created a view based outline view as here. i filled the row by black color, but the background of disclosure button was not appearing with black background. how to fix this.
i set outlineview indentation as 0 in inspector window .problem solved.

NSTextField outer cell background inside custom draw view

I'm struggling with an NSTextField background issue. The textfield is within a custom view that has a semi-transparent black background. I've tried subclassing the field, the field's cell and a few other things to no avail. I'm getting this clearColor background outside of the text field cell. I'm looking for basically just a black NSSearchFeld, not having much luck though.
here is what i'm getting
I basically just want a textfield with a rounded stroke which blends into the black background.
thanks all, i'm fairly new to Xdev
figured it out, I needed to have the custom NSView subclass I'm using to draw the window use
[self bounds] when drawing vs the dirtyRect passed to the drawrect method.

Remove or prevent the active widget highlight

In the above example image, how do I go about preventing the blue highlight you can see on the top and right side of the NSOutlineView control?
That's called the "Focus Ring". You should be able to stop your view from drawing it either through IB:
Or in code, using setFocusRingType::
[myView setFocusRingType:NSFocusRingTypeNone];

setBackgroundColor covers element

I have an NSWindow, and I'm using this code to add a bottom-metal-bar at the bottom.
[MyWindow setContentBorderThickness:40.0 forEdge:NSMinYEdge];
That works fine. But, once I use this:
[MyWindow setBackgroundColor: [NSColor redColor]];
The red covers the bar at the bottom. The bar shows correctly without the background color.
Yes, it would appear that changing the background-color of an NSWindow negates its bottom border. In order to achieve both effects, you can do one of two things:
In Interface Builder, move all your interface elements to a subclass of NSView that draws its background and add the view to your window.
Create an NSView that emulates the bottom border of your window and set the window's background color.
Personally, I would go for the first option, because it requires less work (trying to emulate a bottom border will be difficult, even with NSGradient) , but both are a possibility.