cocoa - NSOutlineView with transparent field editor -


I am working with NSOutlineView located on an HUD panel. I have configured it so that it can not drag its background. As long as I do not double click to edit a cell, everything looks fine, the field editor pulls its background and focus ring, which completely ruins the entire user experience.

I am doing this in the subclass of NSTextFieldCell:

  - (NSText *) SetUpFieldEditorAttributes: (NSText *) textObj {NSText * text = [Super SetupFieldedAditatorAttivate: Textob]; [Text Setdrivebackground: Yes]; [Text setbackgram color: [Enkolar dark gray color]]; Return text; }   

If I use setDrawsBackground: No, it is completely ignored and I get a white background. My solution is very far from being good because I have the alpha component of color Can not touch (if I do this, then the field editor will use the second color as the background), but at least I do not get a white background.

I am thinking that there is a real solution to this problem. Do I have to give my own field editor? is it worth it?

What I want is just a field editor with no background and no focus ring, just cursor blinking.

Thank you! The problem is that white background is prepared by NSTableView when it is sent - Edit Column:

Row: With Event: Select:. It fills the reset of cell with + [nscillar textbackgram collar].

If the developer has a public API to override the current setting for color designated colorpaces, then we can set it within the override-edit column: row: with: Select: or Like I do not remember such an API (appreciation of the indicator). too: I only tested this code on Snow Leopard (also leopard SDK supplement below). Verify code to support real SDK and runtime environment.

NSTableView has a personal accessor that uses it for fill color, but this is only a readable property, no setter, so we do not change the value only on standard NSTableView We have to subclass it (since you want the same behavior in the outline view and NSUTlineview, Already is the subclass of NSTable Weave, we are going to the sub-section of the NSUtillineview. But, separate from the superclass, code Value.)

  @interface ASCOutlineView: NSOutlineView {} @end @implementation ASCOutlineView - _textBackgroundColor {return ([NSColor clearColor]); } @ And   

It seems that while editing the table cells in Snow Leopard, you need to stop that shiny white block from wasting your HUD.

The compiled apps SDK against Leopard requires little more support. Some rendering properties in Leopard's table scenes can be hard-coded, so we need to override an alternative method.

NSTextFieldCells are actually wrappers for NSTextViews so that they can be used within the controls. They usually share the same text view instances, which are managed by the window (or its subclass, panel, in this case). NSTextFieldCell's settings change the system's settings to edit NSTableView data, mostly. NSTextFieldCell then transmits those settings to NSTextView. At any point with this pipeline, we can override one method or two to change the values ​​of those properties to match our own UI.

I use - [NSTextFieldCell setDrawsBackground:] Because it requires very little effort to correct it, it is also important to keep the internal state in line with the effect that we have to achieve in this event. Hopefully, any other object may depend on that situation.

  @interface ASCTextFieldCell: NSTextFieldCell {} @end @ execution ASCTextFieldCell - (zero) setDrawsBackground: {BOOL} Flag {[Super Set Drawbackground: No]; } @ And   

and preventing the focus ring from being displayed, the cell is being edited, its focus is a simple matter of changing the ring type setting. Unfortunately, the IB does not provide access to this property, so it should be done programmatically: [[hudOutlineView tableColumns] for each column [columnCell = [[ASCTextFieldCell alloc] ] InitTextCell: @ ""]; [Each column set data cell: column cell]; If ([column cell responds: @Selector (type setfocusing type :)) = no) [[NSTextFieldCell *] Column set Focusing type: NSFocusRingTypeNone]; }

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -