B4J Question Trap key_event F8 and F10 in an B4J program

Status
Not open for further replies.

Pietro Pancino

Member
Licensed User
Longtime User
HI all

I need to trap keyboard event in the app on top level. (F8, F10 and so on)
It's for displaying a programming tools windows in my global application, even if there is not selected elements (textfields, etc..)

Is there a way to trap key_event like sub mainform_keypress_event or anything else ?

:)
 

bdunkleysmith

Active Member
Licensed User
Longtime User
I use the GameViewHelper library with the following code to capture a press of the F1 key to display a help file.

B4X:
Private gvh As GameViewHelper

gvh.AddKeyListener("keylistener", MainForm)

Sub KeyListener_KeyPressed (KeyCode As String) As Boolean
    If KeyCode.Length = 2 And KeyCode.StartsWith("F1") Then
        Dim mf As ModalForm
        mf.Initialize(MainForm)
        mf.Show
    End If
    Return False
End Sub

Refer: Track the pressing of the buttons F1-F12
 
Upvote 0

Ganiadi

Active Member
Licensed User
Longtime User
Hi Please Help

When i use B4xPage, i can not set the MainForm on gvh.AddKeyListener("keylistener", MainForm)
Can anybody know how to set it

Tks
 
Upvote 0
Status
Not open for further replies.
Top