Ian Vink
Ian Vink

Reputation: 68830

MonoTouch.Dialog - EntryElement not allowing edit of typed in text

I create a simple EntryElement "eNote" and add it to a Section. Super simple.

        Section secNote = new Section ("Notes");
        eNote.AutocapitalizationType = UITextAutocapitalizationType.None;
        eNote.AutocorrectionType = UITextAutocorrectionType.No;
        eNote.KeyboardType = UIKeyboardType.ASCIICapable;
        secNote.Add (eNote);

We type in a sentence like this:

enter image description here

Then when I try to add the text "I Like" before "Unity" by tapping before the "U", the first letter gets entered, but the rest gets put at the end of the text. The result is we can't edit text.

enter image description here

Upvotes: 2

Views: 608

Answers (2)

poupou
poupou

Reputation: 43553

This is a regression caused by this change. If you build MonoTouch.Dialog from source (github) then you can revert the 4cffe144f89fc9fbfe032d56e67a8583c2d641bf commit.

The same change also had other side effects, e.g. #4736, beside the bug report you filled. You should check if this affects your application (or not) to see if the workaround is better than the revert.

Upvotes: 1

holmes
holmes

Reputation: 1341

The short answer is that this is a bug and it should be filed with Xamarin

However I did find a workaround. Using the assembly browser you can "borrow" the existing implementation of the EntryElement and change the Value property to the following.

public string Value
{
    get
    {
        return this.val;
    }
    set
    {
        this.val = value;
        if (this.entry != null && value != null && !value.Equals (this.entry.Text))
        {
            this.entry.Text = value;
        }
    }
}

Happy Hacking!

Upvotes: 2

Related Questions