Good day
With BANano 7, i have been safely defining setTers and getTers with this kind of code, for example... Everything worked perfectly.
and was able to call this with this code
ItemIcon is a sub that returns a component... as defined with
In the definition of SDUIIcon, I do have a seTter for color.
This worked well. Everything was fine.
With BANano V8, things are different, I get an error.
I have changed the code to be..
Whilst I understand what I have to do to fix this bug in my code (a lot of technical debt) if i have to use v8, my question is, going forward. Is it recommended to use getters & setters in BANano? The b4j IDE does not pick this as an error at all (expected), up until BANano v8 transpiles the source code, then all hell breaks loose. I understand the need to enhance how BANano works and the improvements, these are appreciated, sadly this is a major breaking change across everything Ive done so far.
My solution to this is to rename all my get / set subs from using small s and small g to use big S and big G. This will make them subs and not getters and setters. This will enable me to see where i need to make updates on the b4xlib and also apps made so far. That will be a lot.
I should ask though, is there any better way that I can address this? I know I can just stick to V7, stopping growth.
With BANano 7, i have been safely defining setTers and getTers with this kind of code, for example... Everything worked perfectly.
B4X:
'set Icon Color
Sub setIconColor(s As String)
s = SDUIShared.CStr(s)
ItemIcon(mName).Color = s
End Sub
and was able to call this with this code
B4X:
someComponent.IconColor = "black"
ItemIcon is a sub that returns a component... as defined with
B4X:
'get the icon
'<code>
'stats2.ItemIcon("likes").Large = True
'</code>
Sub ItemIcon(itemID As String) As SDUIIcon
itemID = SDUIShared.CleanID(itemID)
If BANano.Exists($"#${itemID}"$) Then
ItemFigure(itemID).show
Dim el As SDUIIcon
el.AssignElement(mback, $"${itemID}_icon"$)
el.show
Return el
Else
BANano.Throw($"SDUIStat.Icon: '${itemID}' does not exist!"$)
Return Null
End If
End Sub
In the definition of SDUIIcon, I do have a seTter for color.
B4X:
'color constants
Sub setColor(s As String)
Root.textColor(s)
End Sub
This worked well. Everything was fine.
With BANano V8, things are different, I get an error.
B4X:
[ERROR 28]: [seticoncolor: 170] color was neither found as global variable, nor method in sduiicon!
I have changed the code to be..
B4X:
'set Icon Color
Sub setIconColor(s As String)
s = SDUIShared.CStr(s)
ItemIcon(mName).setColor(s)
End Sub
Whilst I understand what I have to do to fix this bug in my code (a lot of technical debt) if i have to use v8, my question is, going forward. Is it recommended to use getters & setters in BANano? The b4j IDE does not pick this as an error at all (expected), up until BANano v8 transpiles the source code, then all hell breaks loose. I understand the need to enhance how BANano works and the improvements, these are appreciated, sadly this is a major breaking change across everything Ive done so far.
My solution to this is to rename all my get / set subs from using small s and small g to use big S and big G. This will make them subs and not getters and setters. This will enable me to see where i need to make updates on the b4xlib and also apps made so far. That will be a lot.
I should ask though, is there any better way that I can address this? I know I can just stick to V7, stopping growth.
Last edited: