tunderin Member Licensed User Longtime User Oct 20, 2012 #1 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: Code: Copy 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...
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: Code: Copy 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...
Erel B4X founder Staff member Licensed User Longtime User Oct 21, 2012 #2 Are you referring to home screen widgets? Such widgets cannot trap key presses (Android design). Upvote 0