Per @Erel's post: https://www.b4x.com/android/forum/threads/save-and-load-csbuilders.98257/
I've started a library to encapsulate this class, I've gotten everything implemented except the .Image method and the .Typeface method (as I don't believe the B4XSerializer will deal with these).
I'm attempting to implement the .Clickable and .EnableClickEvents methods but they seem to be getting ignored. Here are the relevant bits of code from the class:
I am aware this can fail if the Tag object is not a simple object, in my testing I'm just using a string. Again here's the relevant bit o'code using the class:
The label appears correct but my "Link1_Click(Tag as Object)" sub never gets called. Is this not possible or did I mess something up?
I've started a library to encapsulate this class, I've gotten everything implemented except the .Image method and the .Typeface method (as I don't believe the B4XSerializer will deal with these).
I'm attempting to implement the .Clickable and .EnableClickEvents methods but they seem to be getting ignored. Here are the relevant bits of code from the class:
B4X:
'
Sub Class_Globals
Private moCS As CSBuilder
Private moData As List
Private moSer As B4XSerializator
End Sub
' ...
Public Sub FromBytes(b() As Byte) As PCSBuilder
Dim list As List = moSer.ConvertBytesToObject(b)
For Each o() As Object In list
If o.Length = 1 Then
CallSub(Me, o(0))
Else
If o.Length = 2 Then
CallSub2(Me, o(0), o(1))
Else
CallSub3(Me, o(0), o(1), o(2))
End If
End If
Next
Return Me
End Sub
' ...
Public Sub Clickable(EventName As String, Tag As Object) As PCSBuilder
moCS.Clickable(EventName, Tag)
moData.Add(Array("clickable", EventName, Tag))
Return Me
End Sub
'
Public Sub EnableClickEvents(oView As Object)
moCS.EnableClickEvents(oView)
End Sub
B4X:
foPCS.Clickable("Link1", "https://www.b4x.com").Underline.Append("Click this for B4X.com").PopAll.AppendLine(".")
foPCS.EnableClickEvents(Label1)
Label1.Text = foPCS.ToCharSequence