Drag&drop within formatted text field?
Drag&drop within formatted text field?
- Subject: Drag&drop within formatted text field?
- From: Bill Cheeseman <email@hidden>
- Date: Wed, 06 Mar 2002 15:07:59 -0500
I have an on-the-fly NSFormatter subclass working in every respect except
one: I cannot get it to work right with drag-and-drop editing within the
text field.
Background: Dragging text within a text field is done in two phases: the
first phase "pastes" the dragged characters into the destination location,
and the second phase "cuts" them from the source location. You can see this
happening if you implement NSControl's controlTextDidChange delegate method
in the text field's delegate: the delegate method gets called twice.
Problem: With an on-the-fly formatter connected to the text field, the
formatter's isPartialStringValid:... method gets called twice. The drag and
drop mechanism performs its second, or "cut," operation between these two
calls, but it does not update the origSelRange and proposedSelRangePtr
parameter values. These values remain as they were before the "paste"
operation and the first call to the formatter. As a result, if the formatter
removes or inserts characters on the fly in the first, or "paste," phase,
its manipulations in the second, or "cut," phase end up working with invalid
ranges.
Does anybody with deep knowledge of drag and drop and NSFormatter have a
solution? I am tempted to call this a bug in NSFormatter.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont -
http://members.valley.net/croquetvermont
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.