This is my first Custom View. The approach I'm taking is to add a class named SignatureWidget for which I have prescribed Initialize and DesignerCreateView. But apparently views my widget is composed of are not be instantiated?
I add a CustomView to my main display selecting SignatureWidget as the custom type.
This is my first try at a Custom View implemented as a B4A class, so sure I'm doing SOMETHING wrong, but sure don't see it from the very few other examples I see posted.
I add a CustomView to my main display selecting SignatureWidget as the custom type.
B4X:
'Class module
Sub Class_Globals
Private mTarget As Object
Private mEventName As String
Private mlblTitle As Label
Private mlblTitle2 As Label
Private mlblTimestamp As Label
Private mlblSignedBy As Label
Private mSignatureImage As ImageView
Private mSignatureBorder As Panel
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize( TargetModule As Object, EventName As String )
mTarget = TargetModule
mEventName = EventName
End Sub
Sub DesignerCreateView(Base As Panel, Lbl As Label, Props As Map)
mlblTitle.Initialize("")
mlblTitle2.Initialize("")
mlblTimestamp.Initialize("")
mlblSignedBy.Initialize("")
mSignatureImage.Initialize("Image")
mlblTitle.Text = ""
mlblTitle2.Text = ""
mlblTimestamp.Text = ""
mlblSignedBy.Text = ""
mlblTitle.TextColor = Lbl.TextColor
mlblTitle2.TextColor = Lbl.TextColor
mlblTimestamp.TextColor = Lbl.TextColor
mlblSignedBy.TextColor = Lbl.TextColor
Base.AddView(mlblTitle,0,0,Base.Width/2,50)
Base.AddView(mlblTitle2, Base.Width/2,0,Base.Width/2,50)
Base.AddView(mSignatureImage,10,60,Base.Width-20,Base.Height-160)
Base.AddView(mSignatureBorder,mSignatureImage.Left-1,mSignatureImage-1,mSignatureImage.Width+2,mSignatureImage.Height+2)
Base.AddView(mlblTimestamp,0,Base.Height-100,Base.Width,50)
Base.AddView(mlblSignedBy,0,Base.Height-50,Base.Width,50)
End Sub
Public Sub setTitle(Title As String)
mlblTitle.Text = Title <-- NullPointerException
End Sub
Public Sub getTitle() As String
Return mlblTitle.Text
End Sub
Public Sub setTitle2(Title2 As String)
mlblTitle2.Text = Title2
End Sub
Public Sub getTitle2() As String
Return mlblTitle2.Text
End Sub
Public Sub setSignedBy(SignedBy As String)
mlblSignedBy.Text = SignedBy
End Sub
Public Sub getSignedBy() As String
Return mlblSignedBy.Text
End Sub
Public Sub setTimestamp(Timestamp As String)
mlblTimestamp.Text = Timestamp
End Sub
Public Sub getTimestamp() As String
Return mlblTimestamp.Text
End Sub
This is my first try at a Custom View implemented as a B4A class, so sure I'm doing SOMETHING wrong, but sure don't see it from the very few other examples I see posted.