B4J Question Touch Screen event


Licensed User
Longtime User
I setup Odroid H2 (https://wiki.odroid.com/odroid-h2/start) with Odroid VU7+ display (https://wiki.odroid.com/accessory/display/vu_series/vu7a_plus/vu7a_plus)
And setup touchscreen driver (https://wiki.odroid.com/odroid-h2/application_note/howto_install_vu_touchdriver)
OS is using Lubuntu 18.04 64 bit with kernel 4.15.

On boot, touchscreen is working in Lubuntu desktop. Icon can be tapped normally.

Then I create very simple B4J UI app, consist 1 button and 1 label
Very Simple UI:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private Button1 As B4XView
    Private Label1 As B4XView
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.WindowWidth = fx.PrimaryScreen.MaxX * 0.7
    MainForm.WindowHeight = fx.PrimaryScreen.MaxY * 0.5
    MainForm.RootPane.LoadLayout("main") 'Load the layout file.
    MainForm.AlwaysOnTop= True
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Private Sub Button1_Click
    Log($"Button clicked"$)
    Label1.Text = $"Tapped at $DateTime{DateTime.Now}"$
End Sub

Private Sub Button1_MouseClicked (EventData As MouseEvent)
    Log($"Button MouseClick"$)
End Sub

Private Sub Button1_MousePressed (EventData As MouseEvent)
    Log($"Button MousePressed"$)
End Sub

Private Sub Button1_MouseEntered (EventData As MouseEvent)
    Log($"Button MouseEntered"$)
End Sub

Private Sub Button1_MouseReleased (EventData As MouseEvent)
    Log($"Button MouseReleased"$)
End Sub

Private Sub Button1_FocusChanged (HasFocus As Boolean)
    Log($"Button FocusChanged : ${HasFocus}"$)
End Sub

Button1_Click event is not triggered.
Instead , Button1 FocusChanged and Button1 MouseEntered were triggered.

Button1_FocusChanged is triggered even when I tapped on panel, but not on button

Using normal mouse, Button1_Click event is triggered normally.

What might wrong ?


Licensed User
Longtime User
However, visually, when I tapped the button, it kind of visually changed, just as when it clicked by mouse.
Upvote 0