B4J Question blocked ESC key

Tayfur

Well-Known Member
Licensed User
Longtime User
hello;

I used Full screen on java.
but; I cant cancel event with keyborad (ESC key);
How can i blocked key event for ESC

Untitled.png


B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    '----full screen modu oldu---
        Dim mf As JavaObject = MainForm
        mf.GetFieldJO("stage").RunMethod("setFullScreen", Array(True))
   
MainForm.RootPane.LoadLayout("Main_from") 'Load the layout file.
    MainForm.Show
    MainForm.Resizable=False
   
    Dim gvh As GameViewHelper
    gvh.AddKeyListener("GVH",MainForm)
End Sub

Sub GVH_KeyPressed (KeyCode As String) As Boolean
    Log(KeyCode)
    Return False' try TRUE, same result
End Sub
Sub GVH_KeyReleased (KeyCode As String) As Boolean
   
    Log("--"&KeyCode)
    Return FALSE ' try TRUE, same result
End Sub
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Full screen mode without an exit key:
B4X:
Dim stage As JavaObject = MainForm
stage = stage.GetFieldJO("stage")
stage.RunMethod("setFullScreenExitHint", Array(""))
Dim nomatch As JavaObject
nomatch = nomatch.InitializeStatic("javafx.scene.input.KeyCombination").GetField("NO_MATCH")
stage.RunMethod("setFullScreenExitKeyCombination", Array(nomatch))
stage.RunMethod("setFullScreen", Array(True))
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User
Full screen mode without an exit key:
B4X:
Dim stage As JavaObject = MainForm
stage = stage.GetFieldJO("stage")
stage.RunMethod("setFullScreenExitHint", Array(""))
Dim nomatch As JavaObject
nomatch = nomatch.InitializeStatic("javafx.scene.input.KeyCombination").GetField("NO_MATCH")
stage.RunMethod("setFullScreenExitKeyCombination", Array(nomatch))
stage.RunMethod("setFullScreen", Array(True))
thanks @Erel;
its perfect.
 
Upvote 0
Top