Android Question label not receiving _click event

epiCode

Active Member
Licensed User
I have a custom class which has one label and one panel, initialized like this

Custom Class:
// In DesignerCreateView sub
//......
lbLabel.initialize("Lbl")
Panel1.initialize("Pnl")
//......

//also there are sub to handle _click event for both

Private Sub Pnl_Click
    Log("This is working")
End Sub

Private Sub Lbl_Click
    Log("This one decided not to")
End Sub

Panel_click fires but label does not.

Suggestions welcome!!
 

Star-Dust

Expert
Licensed User
Longtime User
Make sure that the event name is correct (Lbl) and that there is no other view (or panel) in front of the Label
 
Upvote 0

epiCode

Active Member
Licensed User
Do you see the label? How do you add it?
Yes its visible and enabled
it acquires its properties from Designer Label


Can you post all the code where the label and panel are added to mbase.
Custom Class:
Public Sub Initialize (Callback As Object, EventName As String)

    mEventName = EventName
    mCallBack = Callback

   pnlMark.Initialize("pnl")
   lblMain.Initialize("lab")
End Sub

Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)

    mBase = Base
    Tag = mBase.Tag
    mBase.Tag = Me

//code to get data from designer view goes here (generic color variables etc)

    lblMain = Lbl ' acquire text properties from Designer lbl - Could this be the problem ?

    mask.AddView(lblMain,0,0,0,0) ' just added the view here label size is resized in Alignlabels to fill mbase - it covers maximum view of mbase
    mask.AddView(pnlMark,0,0,0,0) ' just added the view here panel size is resized in Alignlabels  - it covers only a tiny part of mbase

    Alignlabels
End Sub

Private Sub Alignlabels
// removed code here for readability ( align labels etc and set padding)
End Sub

//removed code to handle properties and methods (generic stuff)

Private Sub Lab_Click
    Log("Not firing")
End Sub

Private Sub Pnl_Click
    Log("Works fine")
End Sub
 
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Change to
B4X:
lblMain.Text = Lbl.Text
 
Upvote 0
Top