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

    Code:
    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:
    Code:
    Dim lbl As Label = Button1
    lbl.Text = 
    "aaa"
     
  3. b4auser1

    b4auser1 Well-Known Member Licensed User

    Thank you for detailed explanation !
    I have found a workaround for my situation.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice