ChatGPT - Will it be able to fix your source code?

LucaMs

Expert
Licensed User
Longtime User
Obviously "... your source code..." since mine is always perfect ?


(Me) Can you fix the following B4X source code?
B4X:
Dm Button1 s btton
Button1.Initilalize.FirstTime
Activity.AddViw(Button1, 0, 0, 100, 50, "Press me")

Priate Button1_Click
Button1.TestString = "Pressed"


(ChatGPT) Certainly! There appears to be some spelling and syntax errors in your B4X code. Here is a corrected version:
B4X:
Dim Button1 As Button
Button1.Initialize("Button1")
Activity.AddView(Button1, 0, 0, 100, 50)
Button1.Text = "Press me"

Sub Button1_Click
    Button1.Text = "Pressed"
End Sub

1702449771869.png



It just made one mistake: I wanted Sub Button1_Click to be private.
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
I seldom have typo issue. The IDE would correct for me.
The IDE tells you that line

Button1.txt

contains an unknown member, txt, but it does not say that the Text member exists.

If you write:

Buttn1.Text

it tells you that you haven't declared a variable named Buttn1, but not that you have one named Button1 and that this might be the one you wanted to use.
 
Top