Bug? Statement "is Label" returns true for Dim l_Button As Button

Discussion in 'Bugs & wishlist' started by b4auser1, Jun 28, 2015.

  1. b4auser1

    b4auser1 Well-Known Member Licensed User

    B4A 5.02

    Dim l_Button As Button : l_Button.Initialize("")

    Log($"l_Button = ${l_Button Is Label}"$)
    Log($"l_Button = ${l_Button Is Button}"$)

    Dim l_View As View = l_Button

    Log($"l_View = ${l_View Is Label}"$)
    Log($"l_View = ${l_View Is Button}"$)
    l_Button = true
    l_Button = true
    l_View = true
    l_View = true
  2. Erel

    Erel Administrator Staff Member Licensed User

    A Button is a subclass of Label. So it will return true.

    Note that you can actually treat a button as a label:
    Dim lbl As Label = Button1
    lbl.Text = 
  3. b4auser1

    b4auser1 Well-Known Member Licensed User

    Thank you for detailed explanation !
    I have found a workaround for my situation.