I've got an NSTextField within a layer-backed view, with several other
layers. The text field sits hidden on top of two other CALayers. When the
view is double clicked, the NSTextField is unhidden, to allow the user to
edit the text. When the user completes the editing, I want to hide the
NSTextField, as an animated CATextLayer will begin playing beneath the
textField. When I attempt to hide the NSTextField and begin the animation, I
get the NSView lockFocus assertion failure.
I hide the NSTextField in the action method, and begin the animation on the
lower layer. The NSTextField.hidden property is bound to textFieldIshidden
of marqueeView. The assertion failure occurs even when I comment out the
animation call. Looking at the stack trace, it looks like a problem drawing
the focusRing, although I've set the focusRingType to NSFocusRingTypeNone.

Is there a more appropriate place to hide the textField, in order to show
the animation below it?

Method below is set as the action of the NSTextField.

- (IBAction)processTextField:(id)sender {

    NSLog(@"processTextField:");

    [marqueeView setTextFieldIsHidden:YES];

    [marqueeView animateMarquee];
}


*2009-04-15 17:48:32.740 iLogSPCocoa[55352:813] *** Assertion failure in
-[NSTextField lockFocus],
/SourceCache/AppKit/AppKit-949.43/AppKit.subproj/NSView.m:4755*

*
*

#0 0x96101e17 in objc_exception_throw
#1 0x95ec0eeb in +[NSException raise:format:arguments:]
#2 0x947b56a4 in -[NSAssertionHandler
handleFailureInMethod:object:file:lineNumber:description:]
#3 0x94b59a0f in -[NSView lockFocus]
#4 0x94e6b1b5 in -[_NSKeyboardFocusClipView
_drawKeyboardFocusRingWithFrame:forCell:]
#5 0x94ad1c0e in -[NSTextFieldCell drawWithFrame:inView:]
#6 0x94acb517 in -[NSControl drawRect:]
#7 0x94ba87ca in -[NSView(NSInternal)
_recursive:displayRectIgnoringOpacity:inContext:topView:]
#8 0x95143f08 in -[NSView(NSLayerKitGlue) drawLayer:inContext:]
#9 0x939fffb4 in -[CALayer drawInContext:]
#10 0x93be0cd1 in backing_callback
#11 0x939ffb67 in CABackingStoreUpdate
#12 0x939ff291 in -[CALayer _display]
#13 0x94dc8daa in -[NSView(NSInternal)
_recursiveDisplayViewsIntoLayersIfNeeded]
#14 0x94dc8e4c in -[NSView(NSInternal)
_recursiveDisplayViewsIntoLayersIfNeeded]
#15 0x94dc8bfd in -[NSView(NSLayerKitGlue) _drawRectAsLayerTree:]
#16 0x94b5e43e in -[NSView _drawRect:clip:]
#17 0x94b5cb0d in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#18 0x94b5d543 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#19 0x94b5d543 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#20 0x94b5c02b in -[NSThemeFrame
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#21 0x94b58b4f in -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
#22 0x94a99523 in -[NSView displayIfNeeded]
#23 0x94a990d1 in -[NSWindow displayIfNeeded]
#24 0x94a98ef4 in _handleWindowNeedsDisplay
#25 0x95e459a2 in __CFRunLoopDoObservers
#26 0x95e46cfc in CFRunLoopRunSpecific
#27 0x95e47cd8 in CFRunLoopRunInMode
#28 0x922392c0 in RunCurrentEventLoopInMode
#29 0x92239012 in ReceiveNextEventCommon
#30 0x92238f4d in BlockUntilNextEventMatchingListInMode
#31 0x94a96d7d in _DPSNextEvent
#32 0x94a96630 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
#33 0x94a8f66b in -[NSApplication run]
#34 0x94a5c8a4 in NSApplicationMain
#35 0x00001fd0 in main at main.m:13
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to