D davemorris Active Member Licensed User Longtime User Apr 12, 2025 #1 Hi, Guys Just typed "does b4a support with" into Google and got (from the AI) Yes, B4A supports "with". "With" is a keyword in the B4A language, used to define properties of a class or object. It allows you to access and modify the properties of an object without repeating the object's name. For example, in B4A you might use "with" to set multiple properties of a ListView object: Follow with with a code example. My simple attempts to use the with keyword failed - it highlights "with" in red so I did not continue. Basically am I using "with" correctly or are we looking at the more AI questionable results. Regards Dave
Hi, Guys Just typed "does b4a support with" into Google and got (from the AI) Yes, B4A supports "with". "With" is a keyword in the B4A language, used to define properties of a class or object. It allows you to access and modify the properties of an object without repeating the object's name. For example, in B4A you might use "with" to set multiple properties of a ListView object: Follow with with a code example. My simple attempts to use the with keyword failed - it highlights "with" in red so I did not continue. Basically am I using "with" correctly or are we looking at the more AI questionable results. Regards Dave
B Brian Dean Well-Known Member Licensed User Longtime User Apr 12, 2025 #2 I asked Copilot this question - Is there an equivalent of the keyword "with", used in Delphi, in B4X Click to expand... I got this answer - B4X does not have a direct equivalent to Delphi's keyword. However, you can achieve similar functionality by using local variables to simplify code and reduce repetitive references. Here's an example: Click to expand... Here is the example, which I found unconvincing - B4X: Dim Person As Map Person.Initialize Person.Put("Name", "Alice") Person.Put("Age", 30) ' Using local variables to simplify access Dim Name As String = Person.Get("Name") Dim Age As Int = Person.Get("Age") Log("Name: " & Name) Log("Age: " & Age)[/CODE Upvote 0
I asked Copilot this question - Is there an equivalent of the keyword "with", used in Delphi, in B4X Click to expand... I got this answer - B4X does not have a direct equivalent to Delphi's keyword. However, you can achieve similar functionality by using local variables to simplify code and reduce repetitive references. Here's an example: Click to expand... Here is the example, which I found unconvincing - B4X: Dim Person As Map Person.Initialize Person.Put("Name", "Alice") Person.Put("Age", 30) ' Using local variables to simplify access Dim Name As String = Person.Get("Name") Dim Age As Int = Person.Get("Age") Log("Name: " & Name) Log("Age: " & Age)[/CODE
Erel B4X founder Staff member Licensed User Longtime User Apr 13, 2025 #3 The answer above is correct, though the example is indeed irrelevant. Better example: Code: Dim p As Person = SomeObject.ThatHoldsAnotherObject.AndHere.Person1 p.Name = "Alice" Upvote 0
The answer above is correct, though the example is indeed irrelevant. Better example: Code: Dim p As Person = SomeObject.ThatHoldsAnotherObject.AndHere.Person1 p.Name = "Alice"