Trap keypress event in a widget??

tunderin

Member
Licensed User
Longtime User
Hello,

Do B4A widgets have support for key press event trapping ???

My widget activates an AHPreferenceActivity screen by tapping an imageview on the widget.

I'm trying to trap the back key press when the AHPreferenceScreen is closed by user - using a sub like this:

B4X:
Sub activity_KeyPress (KeyCode As Int) As Boolean
    If KeyCode = KeyCodes.KEYCODE_BACK Then
'      subs.configBackup
      ToastMessageShow("Back key pressed",True)

    End If
   
End Sub

Changing activity_Keypress to WidgetName_Keypress (where "WidgetNAME" is the widget name assigned in the ConfigureHomeWidget method) does not work.

Any help at all would be appreciated...
 
Top