Unable to get letters from keyevent (textbox.KeyPress / softkeyboard)

Hello,

I want to detect when a key on the softkeyboard is being used but somehow my keyevent only fires when i am using numbers and special keys like enter/done. I also need to see when there are letters typed on the softkeyboard. I searched on the internet and nobody has the same problem as i do.

In the oncreate i subscribe the event to my textbox :

txt_LocationCode.KeyPress += OnKeyEvent;

then:

private void onLocation(object sender, View.KeyEventArgs e)
{

}

When i type numbers in the textbox txt_LocationCode the event fires but not when i type letters. Does anyone know what i am doing wrong?

Thanks in advance for your answers.

Regards,

JJ Louwerse

Posts

  • JohnRowseJohnRowse GBMember ✭✭

    You are not doing anything wrong; this is just how Android has been designed. It is only hardware keyboards that trigger this, although some configurations have also elected certain 'special' keys to trigger the event, as you have experienced.

    .TextChanged will allow you to subscribe to all text input changes, including softkeyboard. if you have other input sources (e.g. loading of data) that you need to filter, then also monitoring the focus status of the control, and reviewing at the point of the textchange firing, should help.

Sign In or Register to comment.