Hello.
When I convert my old B4A Word Game app to B4I, I encountered button click problem. The button at the rightmost doesn't always catch click event. It only works when I press left side of the button. Button number depends on word length so it changes at every level.
I tried other apps that have buttons on the right side without any click problem.
To show this I wrote a simple program. Please try this sample.
Error appears when clicked on the number 2. On some buttons, click event is not catched.
When buttons at the left, Click problem doesn't occur.
When I convert my old B4A Word Game app to B4I, I encountered button click problem. The button at the rightmost doesn't always catch click event. It only works when I press left side of the button. Button number depends on word length so it changes at every level.
I tried other apps that have buttons on the right side without any click problem.
To show this I wrote a simple program. Please try this sample.
Error appears when clicked on the number 2. On some buttons, click event is not catched.
When buttons at the left, Click problem doesn't occur.
B4X:
'Code module
#Region Project Attributes
#ApplicationLabel: Click
#Version: 1.0.0
'Orientation possible values: Portrait, LandscapeLeft, LandscapeRight and PortraitUpsideDown
#iPhoneOrientations: Portrait
#iPadOrientations: Portrait
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private Button1 As Button
Private Button2 As Button
Private Button3 As Button
Private Button4 As Button
Private Button5 As Button
Private Button6 As Button
Private Button7 As Button
Private Button8 As Button
Private Label1 As Label
Private leftbutton,rightbutton As Button
Dim i1,i2,i3,i4,i5,i6,i7,i8 As Int
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Page1.Title = "Page 1"
Page1.RootPanel.Color = Colors.White
Label1.Initialize("Label1")
Button1.Initialize("Button1",Button1.STYLE_SYSTEM)
Button2.Initialize("Button2",Button2.STYLE_SYSTEM)
Button3.Initialize("Button3",Button3.STYLE_SYSTEM)
Button4.Initialize("Button4",Button4.STYLE_SYSTEM)
Button5.Initialize("Button5",Button5.STYLE_SYSTEM)
Button6.Initialize("Button6",Button6.STYLE_SYSTEM)
Button7.Initialize("Button7",Button7.STYLE_SYSTEM)
Button8.Initialize("Button8",Button8.STYLE_SYSTEM)
leftbutton.Initialize("leftbutton",leftbutton.STYLE_SYSTEM)
rightbutton.Initialize("rightbutton",rightbutton.STYLE_SYSTEM)
Page1.RootPanel.AddView(Button1,80%x,10%y,20%x,8%y)
Page1.RootPanel.AddView(Button2,80%x,20%y,20%x,8%y)
Page1.RootPanel.AddView(Button3,80%x,30%y,20%x,8%y)
Page1.RootPanel.AddView(Button4,80%x,40%y,20%x,8%y)
Page1.RootPanel.AddView(Button5,80%x,50%y,20%x,8%y)
Page1.RootPanel.AddView(Button6,80%x,60%y,20%x,8%y)
Page1.RootPanel.AddView(Button7,80%x,70%y,20%x,8%y)
Page1.RootPanel.AddView(Button8,80%x,80%y,20%x,8%y)
Page1.RootPanel.AddView(leftbutton,35%x,50%y,30%x,15%y)
Page1.RootPanel.AddView(rightbutton,35%x,70%y,30%x,15%y)
Page1.RootPanel.AddView(Label1,40%x,30%y,20%x,10%y)
NavControl.ShowPage(Page1)
NavControl.NavigationBarVisible = False
NavControl.ToolBarVisible = False
Button1.Left=100%x-Button1.Width
Button2.Left=100%x-Button1.Width
Button3.Left=100%x-Button1.Width
Button4.Left=100%x-Button1.Width
Button5.Left=100%x-Button1.Width
Button6.Left=100%x-Button1.Width
Button7.Left=100%x-Button1.Width
Button8.Left=100%x-Button1.Width
Button1.Color=Colors.LightGray
Button2.Color=Colors.LightGray
Button3.Color=Colors.LightGray
Button4.Color=Colors.LightGray
Button5.Color=Colors.LightGray
Button6.Color=Colors.LightGray
Button7.Color=Colors.LightGray
Button8.Color=Colors.LightGray
Button1.Text="1 2"
Button2.Text="1 2"
Button3.Text="1 2"
Button4.Text="1 2"
Button5.Text="1 2"
Button6.Text="1 2"
Button7.Text="1 2"
Button8.Text="1 2"
leftbutton.Color=Colors.Green
rightbutton.Color=Colors.Cyan
leftbutton.Text="<<<<<"
rightbutton.Text=">>>>"
Button1.Top=10%y
Button2.Top=20%y
Button3.Top=30%y
Button4.Top=40%y
Button5.Top=50%y
Button6.Top=60%y
Button7.Top=70%y
Button8.Top=80%y
i1=0
i2=0
i3=0
i4=0
i5=0
i6=0
i7=0
i8=0
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
End Sub
Private Sub Application_Background
End Sub
Sub Button8_Click
i8=i8+1
Label1.Text="8_"&i8
End Sub
Sub Button7_Click
i7=i7+1
Label1.Text="7_"&i7
End Sub
Sub Button6_Click
i6=i6+1
Label1.Text="6_"&i6
End Sub
Sub Button5_Click
i5=i5+1
Label1.Text="5_"&i5
End Sub
Sub Button4_Click
i4=i4+1
Label1.Text="4_"&i4
End Sub
Sub Button3_Click
i3=i3+1
Label1.Text="3_"&i3
End Sub
Sub Button2_Click
i2=i2+1
Label1.Text="2_"&i2
End Sub
Sub Button1_Click
i1=i1+1
Label1.Text="1_"&i1
End Sub
Sub leftbutton_Click
Button1.Left=0
Button2.Left=0
Button3.Left=0
Button4.Left=0
Button5.Left=0
Button6.Left=0
Button7.Left=0
Button8.Left=0
End Sub
Sub rightbutton_Click
Button1.Left=100%x-Button1.Width
Button2.Left=100%x-Button1.Width
Button3.Left=100%x-Button1.Width
Button4.Left=100%x-Button1.Width
Button5.Left=100%x-Button1.Width
Button6.Left=100%x-Button1.Width
Button7.Left=100%x-Button1.Width
Button8.Left=100%x-Button1.Width
End Sub