LucaMs Expert Licensed User Longtime User Dec 13, 2023 #1 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 It just made one mistake: I wanted Sub Button1_Click to be private. Last edited: Dec 13, 2023
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 It just made one mistake: I wanted Sub Button1_Click to be private.
LucaMs Expert Licensed User Longtime User Dec 13, 2023 #2 Tip: Don't write code like that; create B4XPages projects and Views in the Designer.
aeric Expert Licensed User Longtime User Dec 13, 2023 #3 I seldom have typo issue. The IDE would correct for me.
LucaMs Expert Licensed User Longtime User Dec 13, 2023 #4 aeric said: I seldom have typo issue. The IDE would correct for me. Click to expand... 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.
aeric said: I seldom have typo issue. The IDE would correct for me. Click to expand... 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.