Got soft keyboard working to some degree on Android

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Got soft keyboard working to some degree on Android

Dimitry Golubovsky
 
Hi,

I got the soft keyboard working with Squeak on a Pandigital Novel 9"
tablet (Android 2.0).

I had to add call to view.setFocusableInTouchMode(true) in the end of
the onCreate method of SqueakActivity. Without that, the activity view
could not get keyboard focus, even when touched. I haven't tested
whether the focus is restored properly when activity changes its
state, but such change may require more support anyway.

See here *:

http://code.google.com/p/squeakvm-tablet/source/browse/project/src/org/squeak/android/SqueakActivity.java

I also changed the SqueakView class so that the physical "Menu" button
toggles the soft keyboard. I wish it did not take so much screen space
;)

http://code.google.com/p/squeakvm-tablet/source/browse/project/src/org/squeak/android/SqueakView.java

One thing I cannot figure out: how to send an event for BackSpace key.

The following works for alphanumerics (event is the second argument of
View.onKeyDown method):

                                int uchar = event.getUnicodeChar();
                                vm.sendEvent(   2 /* EventTypeKeyboard */,
                                                0 /* timeStamp */,
                                                uchar /* charCode */,
                                                0 /* EventKeyChar */,
                                                0 /* modifiers */,
                                                uchar /* utf32Code */,
                                                0 /* reserved1 */,
                                                0 /* windowIndex */);
                                vm.interpret();

Characters typed on the soft keyboard appear e. g. in a workspace
where a cursor is blinking, window frame becomes red, etc. which means
input works. But pressing DEL does not have any effect.  Enter works
(cursor moves to newline) What values should I put into the
sqInputEvent structure for DEL?

Thanks for any ideas.

------------------------------
* I forked the squeak-android-vm project into
http://code.google.com/p/squeakvm-tablet This project space has not
been set up properly yet in terms of documentation; I just wanted to
share my findings with other possibly interested developers.

--
Dimitry Golubovsky

Anywhere on the Web
Reply | Threaded
Open this post in threaded view
|

Re: Got soft keyboard working to some degree on Android

David T. Lewis
 
On Thu, Feb 24, 2011 at 11:46:55PM -0500, Dimitry Golubovsky wrote:
>  
> Hi,
>
> I got the soft keyboard working with Squeak on a Pandigital Novel 9"
> tablet (Android 2.0).

Great, it's nice to see some progress on the Android VM!

Dave


> I had to add call to view.setFocusableInTouchMode(true) in the end of
> the onCreate method of SqueakActivity. Without that, the activity view
> could not get keyboard focus, even when touched. I haven't tested
> whether the focus is restored properly when activity changes its
> state, but such change may require more support anyway.
>
> See here *:
>
> http://code.google.com/p/squeakvm-tablet/source/browse/project/src/org/squeak/android/SqueakActivity.java
>
> I also changed the SqueakView class so that the physical "Menu" button
> toggles the soft keyboard. I wish it did not take so much screen space
> ;)
>
> http://code.google.com/p/squeakvm-tablet/source/browse/project/src/org/squeak/android/SqueakView.java
>
> One thing I cannot figure out: how to send an event for BackSpace key.
>
> The following works for alphanumerics (event is the second argument of
> View.onKeyDown method):
>
>                                 int uchar = event.getUnicodeChar();
>                                 vm.sendEvent(   2 /* EventTypeKeyboard */,
>                                                 0 /* timeStamp */,
>                                                 uchar /* charCode */,
>                                                 0 /* EventKeyChar */,
>                                                 0 /* modifiers */,
>                                                 uchar /* utf32Code */,
>                                                 0 /* reserved1 */,
>                                                 0 /* windowIndex */);
>                                 vm.interpret();
>
> Characters typed on the soft keyboard appear e. g. in a workspace
> where a cursor is blinking, window frame becomes red, etc. which means
> input works. But pressing DEL does not have any effect.  Enter works
> (cursor moves to newline) What values should I put into the
> sqInputEvent structure for DEL?
>
> Thanks for any ideas.
>
> ------------------------------
> * I forked the squeak-android-vm project into
> http://code.google.com/p/squeakvm-tablet This project space has not
> been set up properly yet in terms of documentation; I just wanted to
> share my findings with other possibly interested developers.
>
> --
> Dimitry Golubovsky
>
> Anywhere on the Web