Android Question Bug ? (edittext seen as label)

advansis

Active Member
Licensed User
Longtime User
Hi guys, I have a problem while checking the type of a view (don't know if previous versions of B4A are affected, mine is 9.30).

B4X:
Dim T As EditText
    T.Initialize("TXT")
    T.Text="My Text Value"
    Activity.AddView(T,10,10,100,100)
   
    If T Is Label Then
        Log("IS A LABEL")
    End If

The EditText object is recognized as a Label (the LOG says: IS A LABEL) !
It is a problem when using GetAllViewsRecursive in a panel populated at runtime....
Is it a bug or inheritance ? If it is inheritance, please tell me how to replicate this feature, sounds interesting...
OR ELSE: is there any other way for type-checking ?

Thank you
 

ALBRECHT

Active Member
Licensed User
Ok, so with IS instead of GetType,

no way to use the Select case statement ...

to check the Type of Object ?
 
Upvote 0

ALBRECHT

Active Member
Licensed User
Thanks, have a good week end.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
no way to use the Select case statement ...
Sure you can!

B4X:
Sub WhichObject(Obj As Object)
    Select True
        Case Obj Is EditText
            Log("EditText")
        Case Obj Is Button
            Log("Button")
        Case Obj Is Label
            Log("Label")
        Case Obj Is ListView
            Log("ListView")
    End Select
End Sub
 
Last edited:
Upvote 0

ALBRECHT

Active Member
Licensed User
- perfect, it's better for me.

- in this case also, it s necessary to check the Label at the end, as said Agraham above ?
 
Upvote 0

ALBRECHT

Active Member
Licensed User
Thanks for all
 
Upvote 0
Top