log(Buttons.Get As B4XView(2).Text)
log(Buttons.Get As B4XView(2).Color)
log(Buttons.Get As B4XView(2).Top)
log(Buttons.Get As B4XView(2).Left)
'vs
Dim btn as BX4View = Buttons.Get(2)
Log(btn.Text)
Log(btn.Color)
Log(btn.Top)
Log(btn.Left)
No. Set doesn't return anything so you cannot cast the result.Would become this (first = Set):
B4X:Buttons.Set As B4XView(5).Text = Buttons.Get As B4XView(2).Text
Buttons.Get As B4XView(5).Text = Buttons.Get As B4XView(2).Text
This looks totally wrong to me with the indexer dissociated from its target. I still don't understand why notB4X:Buttons.Get As B4XView(5).Text = Buttons.Get As B4XView(2).Text
Buttons.Get(5) As B4XView.Text = Buttons.Get(2) As B4XView.Text
I agree.I don't like this at all ?
This is the best ?Like in VB
Buttons(5).Text = Buttons(2).Text
Yes, thankfully the existing syntax will continue to exist, which I surely will use instead.i mean you can, not use it...
This would be true if you only work on code created by you but sometimes this is not the case.i mean you can, not use it...
[Erel was referring to inheritance, here]A programming language is not a random bag of features
Yes, if 'inheritance' gets done, it will help me as I code and think in that way in Xbase++[Erel was referring to inheritance, here]
Dim Buttons As List = Array(Button1, Button2, Button3, Button4, Button5)
Dim s As String = Buttons.Get(2).As(B4XView).Text
Buttons.Get(2).As(B4XView).Text = "abc"
Dim j As String = $"{
data: {
key1: value1,
complex_key2: {key: value2}
},
items: [0, 1, 2]
}"$
Dim parser As JSONParser
parser.Initialize(j)
Dim m As Map = parser.NextObject
Dim value1 As String = m.Get("data").As(Map).Get("key1")
Dim value2 As String = m.Get("data").As(Map).Get("complex_key2").As(Map).Get("key")
Dim FirstItemInList As String = m.Get("items").As(List).Get(0)
For Each item As Int In m.Get("items").As(List)
Log(item)
Next
Root.GetView(8).As(WebView).LoadUrl("https://www.google.com")
Yes I can also read it clearly now and understand. The result is more obvious now.It is simpler and also more powerful as it is no longer limited to methods:
It is indeed and hopefully of more general use. Will it work for all types? For example can I use it for casting any object to its known type?It is simpler and also more powerful as it is no longer limited to methods:
Sender.As(Button).Text = "Fred"
Dim String as Text = Sender.As(Button).Text
This reminds me of what I read a few days ago in another forum. There was a small war inside ?I've never seen that happen on any other forums as usually the developers just release what they think is correct and their users just have to live with it.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?