Skip to content

Commit

Permalink
Resolves issue when editing existing text in SimpleMultilineEntryElem…
Browse files Browse the repository at this point in the history
…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
migueldeicaza committed Dec 3, 2012
1 parent 8d0ea37 commit 0ca9f3b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ElementPack/SimpleMultilineEntryElement.cs
Expand Up @@ -256,11 +256,15 @@ public void FetchValue ()
var newValue = entry.Text; var newValue = entry.Text;
if (newValue == Value) if (newValue == Value)
return; return;


var currentPos = entry.SelectedRange.Location;
Value = newValue; Value = newValue;


if (Changed != null) if (Changed != null)
Changed (this, EventArgs.Empty); Changed (this, EventArgs.Empty);

if (currentPos > 0)
entry.SelectedRange = new NSRange(currentPos, 0);
} }


protected override void Dispose (bool disposing) protected override void Dispose (bool disposing)
Expand Down

0 comments on commit 0ca9f3b

Please sign in to comment.