Husein Behboudi Rad
Husein Behboudi Rad

Reputation: 5462

Detecting when keyboard of a entryelement returns monotouch.dialog

I'm using this code for detect returning from a keyboard of a entry element in the monotouch.dialog.

   RltEntryElement createServerUrlEntry(){

        try {


            ServerNameEntryElement = new EntryElement ("Website url","placeholder",
        "value");


            ServerNameEntryElement .ReturnKeyType = UIReturnKeyType .Done ;
             ServerNameEntryElement.ShouldReturn += ShouldReturnMethd;
            return ServerNameEntryElement ;

        } catch (Exception ex) {
            RltLog .HandleException (ex);
            return null ;
        }
    }

public bool ShouldReturnMethd ()
        {

            RltLog .LogInfo ("Helllllllllllllo");
            return false  ;
        }

It works and log the "Helllllllllllllo" after pressing 'Done' . but the keyboard not disapper. What should I use this to work corectly?

Upvotes: 1

Views: 195

Answers (2)

Henning Schulz
Henning Schulz

Reputation: 627

Just call "ResignFirstResponder"

public bool ShouldReturnMethd ()
{
    RltLog.LogInfo ("Helllllllllllllo");
    ServerNameEntryElement.ResignFirstResponder(true);
    return false;
}

Upvotes: 1

Stephane Delcroix
Stephane Delcroix

Reputation: 16232

Shouldn't it be

return true;

I haven't looked at the doc lately, but the name of the method indicates that you might want to return true

Upvotes: 0

Related Questions