On Dec 14, 2011, at 10:56 AM, Tom wrote:
> I cannot run this sample
> http://docs.xamarin.com/android/tutorials/User_Interface/form_elements/edit_text
> 
> Error CS0079: The event 'Android.Views.View.KeyPress' can only appear on the
> left hand side of += or -= (CS0079) (CustomButton)

Sorry, that broke with the 4.0.0 API changes. I have updated the sample; it 
should be:

        EditText edittext = FindViewById<EditText>(Resource.Id.edittext);

        edittext.KeyPress += (object sender, View.KeyEventArgs e) => {
                if (e.E.Action == KeyEventActions.Down && e.KeyCode == 
Keycode.Enter) {
                        Toast.MakeText (this, edittext.Text, 
ToastLength.Short).Show ();
                        e.Handled = true;
                }
        };

Thanks,
 - Jon

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to