Permalink
Browse files

Resolves issue when editing existing text in SimpleMultilineEntryElem…

…ent. Previously tapping in existing text would allow a single character to be inserted before insertion point would jump to end of text. Solution derived from http://stackoverflow.com/a/13394838/132599 answer.  Patch from @daveclarke
  • Loading branch information...
1 parent 8d0ea37 commit 0ca9f3b9b71f3e783822e09d85881b17c182948d @migueldeicaza migueldeicaza committed Dec 3, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 ElementPack/SimpleMultilineEntryElement.cs
View
6 ElementPack/SimpleMultilineEntryElement.cs
@@ -256,11 +256,15 @@ public void FetchValue ()
var newValue = entry.Text;
if (newValue == Value)
return;
-
+
+ var currentPos = entry.SelectedRange.Location;
Value = newValue;
if (Changed != null)
Changed (this, EventArgs.Empty);
+
+ if (currentPos > 0)
+ entry.SelectedRange = new NSRange(currentPos, 0);
}
protected override void Dispose (bool disposing)

0 comments on commit 0ca9f3b

Please sign in to comment.