Bindings Update with Drag-and-Drop
Bindings Update with Drag-and-Drop
- Subject: Bindings Update with Drag-and-Drop
- From: "K. Darcy Otto" <email@hidden>
- Date: Fri, 17 Apr 2009 19:50:48 -0700
I have a number of NSTextFields that are happily bound to NSString
objects in the controller, and they work very well: if the textfield
is updated, the corresponding NSString object is updated, as vice-
versa. Now, in order to implement drag-and-drop, I have had to
subclass NSTextField and set my textfields to that subclass.
Everything works fine (including typing, paste, and the like) in
terms of updating bindings, with the exception of drag-and-drop.
The problem is that when I drag-and-drop, the corresponding NSString
object is not updated. The textfield display is updated. Here is the
code I'm using in the textfield subclass:
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
...
[self willChangeValueForKey:@"stringValue"];
[self setValue:draggedFormulaString forKey:@"stringValue"];
[self didChangeValueForKey:@"stringValue"];
return YES;
}
Since I do not know the NSString object to which the textfield is
bound at design time, I can't simply go in and set the value of the
NSString and (hopefully) trigger a binding update. Is there any way
to find out which NSString the textfield is bound to? Is there some
other solution? Thanks.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden