Question

So, it works fine if I disable editing for the textfield/textfieldcell... through code or interface builder.

enter image description here (notice the slight shadow)

But once I make it editable ([cell setEditable:YES]) the shadow completely disappears:

enter image description here

I've tried drawing a shadow two ways: One, setting NSBackgroundStyleRaised, and two, overriding - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView to manually create a shadow. Both styles/ways of drawing a shadow stop working once the cell is made editable. (To make it clear, the end result should be inset-looking, editable text. The pictures above only served as a demonstration.)

Can someone tell me why? And how I can get around this issue?

Was it helpful?

Solution

I think I figured out why, at least partially -

Because I was using - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView to set the shadow, and because when editing, the field editor is also doing the drawing (and it's not going through the above mentioned method) the shadow doesn't apply to it.

Confirmation on this might be nice, but for now I'm going to assume this is why the shadow isn't drawing.

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