Android Question [Solved]Error Xui Views in Debug mode

mshafiee110

Active Member
Licensed User
Longtime User
I have the same Error (https://www.b4x.com/android/forum/threads/error-in-xui-viewes.117115/#post-737671) in debug mode and by commenting this line (If Code = xui.DialogResponse_Cancel Then xbtn.RequestFocus) from B4XDialog.bas in XUI Views.b4xlib , the error was fixed.

B4X:
Private Sub CreateButton (Text As Object, Code As Int)
    If Text = "" Then Return
    #if B4J
    Dim btn As Button
    #else
    Dim btn As Label
    #End If
    btn.Initialize("Button") 
    Dim xbtn As B4XView = btn
    InternalSetTextOrCSBuilderToLabel(xbtn, Text)
    xbtn.Tag = Code
    xbtn.SetColorAndBorder(ButtonsColor, 0dip, BorderColor, 5dip)
    xbtn.SetTextAlignment("CENTER", "CENTER")
    xbtn.TextColor = ButtonsTextColor
    xbtn.Font = ButtonsFont
    Dim numberOfButtons As Int = Base.NumberOfViews 'nothing was added yet except of buttons
    Base.AddView(xbtn, Base.Width - 4dip - numberOfButtons * (ButtonWidth + 5dip) - ButtonWidth, _
         Base.Height - ButtonsHeight - 4dip, ButtonWidth, ButtonsHeight)
'Comment this line
  '  If Code = xui.DialogResponse_Cancel Then xbtn.RequestFocus
End Sub
 
Last edited:

mshafiee110

Active Member
Licensed User
Longtime User
Do you have a code module named code?
Thank you, you are very smart.
I changed the name of the Code module and the error was fixed. ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…