ilan Expert Licensed User Longtime User Sep 29, 2021 #1 hi, is there a snipped to convert char to keycode in b4j? i tried using java object but could not get it working thanx
hi, is there a snipped to convert char to keycode in b4j? i tried using java object but could not get it working thanx
Solution Erel Sep 29, 2021 The return type should be Object (I've updated my post). I have a feeling that you are looking for the unicode code point. Code: Copy Log(Asc("a"))
The return type should be Object (I've updated my post). I have a feeling that you are looking for the unicode code point. Code: Copy Log(Asc("a"))
Erel B4X founder Staff member Licensed User Longtime User Sep 29, 2021 #2 Code: Copy Sub KeycodeFromString(s As String) As Object Dim jo As JavaObject Return jo.InitializeStatic("javafx.scene.input.KeyCode").RunMethod("getKeyCode", Array(s.ToUpperCase)) End Sub It will return Null if there is no matching key. Last edited: Sep 29, 2021 Upvote 1
Code: Copy Sub KeycodeFromString(s As String) As Object Dim jo As JavaObject Return jo.InitializeStatic("javafx.scene.input.KeyCode").RunMethod("getKeyCode", Array(s.ToUpperCase)) End Sub It will return Null if there is no matching key.
ilan Expert Licensed User Longtime User Sep 29, 2021 #4 Erel said: Code: Copy Sub KeycodeFromString(s As String) As String Dim jo As JavaObject Return jo.InitializeStatic("javafx.scene.input.KeyCode").RunMethod("getKeyCode", Array(s.ToUpperCase)) End Sub It will return Null if there is no matching key. Click to expand... oopps, i was too early with marking your answer as the solution. what i get is just the STRING back and not the KeyCode Upvote 0
Erel said: Code: Copy Sub KeycodeFromString(s As String) As String Dim jo As JavaObject Return jo.InitializeStatic("javafx.scene.input.KeyCode").RunMethod("getKeyCode", Array(s.ToUpperCase)) End Sub It will return Null if there is no matching key. Click to expand... oopps, i was too early with marking your answer as the solution. what i get is just the STRING back and not the KeyCode
Erel B4X founder Staff member Licensed User Longtime User Sep 29, 2021 #5 The return type should be Object (I've updated my post). I have a feeling that you are looking for the unicode code point. Code: Copy Log(Asc("a")) Upvote 2 Solution
The return type should be Object (I've updated my post). I have a feeling that you are looking for the unicode code point. Code: Copy Log(Asc("a"))
ilan Expert Licensed User Longtime User Sep 29, 2021 #6 Erel said: The return type should be Object (I've updated my post). I have a feeling that you are looking for the unicode code point. Code: Copy Log(Asc("a")) Click to expand... exactly, this is what I was looking for. so simple! thank you very much Erel!! Upvote 0
Erel said: The return type should be Object (I've updated my post). I have a feeling that you are looking for the unicode code point. Code: Copy Log(Asc("a")) Click to expand... exactly, this is what I was looking for. so simple! thank you very much Erel!!