Android Question ime.AddHandleActionEvent -- Syntax check please...

tunderin

Member
Licensed User
Hi everybody,

I'm trying to capture the action button press that dismisses the IME soft keyboard.

ime.AddHandleActionEvent is supposed to add an IME HandleAction event to the action button (in my case, "Done") but it's not working for me, my event handler doesn't trap it.

Does anybody see any problems with the code below?

Thanks...

B4X:
Sub keypad_click
    Dim ime1 As IME
    ime1.AddHandleActionEvent(txt1)   
   
    'if there is text already entered then start with 2 blank lines to separate new from old
    If txt1.Text.Length>0 Then txt1.Text=txt1.Text&CRLF&CRLF
    txt1.SelectionStart=txt1.Text.Length'place cursor at end of existing text
   
    ime1.ShowKeyboard(txt1)

End Sub

Sub ime1_HandleAction As Boolean
    Log("ime1 -- Action key was pressed")

End Sub
 

stevel05

Expert
Licensed User
Without trying it I think ime1 should be a global variable, it's probably also better to set the handler in Sub Activity_Create(FirstTime As Boolean)

You also need to do ime1.Initialize("IME") in Activity_Create before adding the event handler.

Check Erel's example at the bottom of the post here for the proper setups and syntaxes
 
Last edited:
Upvote 0

tunderin

Member
Licensed User
Thanks stevel05 !

All that it took was to remind me intiialize ime1, other than that, everything worked just the way that it was.

You have yet another satisfied customer...
 
Upvote 0
Top