Roberto P. Well-Known Member Licensed User Longtime User Jul 8, 2016 #1 I need to know what class is derived an object of custom controls. I know the function: Code: If CallBack Is Activity Then end if specifically I need to know the class membership of the object that is passed in the custom controls. Code: Public Sub Initialize (vCallback As Object, vEventName As String) EventName = vEventName CallBack = vCallback If CallBack Is Activity Then Log("è una activita") else if CallBack Is Panel Then Log("è un pannello") End If End Sub thanks
I need to know what class is derived an object of custom controls. I know the function: Code: If CallBack Is Activity Then end if specifically I need to know the class membership of the object that is passed in the custom controls. Code: Public Sub Initialize (vCallback As Object, vEventName As String) EventName = vEventName CallBack = vCallback If CallBack Is Activity Then Log("è una activita") else if CallBack Is Panel Then Log("è un pannello") End If End Sub thanks
Erel B4X founder Staff member Licensed User Longtime User Jul 10, 2016 #2 It is difficult to distinguish between activities and panels because both of them are based on the same internal type. What do you need it for? Upvote 0
It is difficult to distinguish between activities and panels because both of them are based on the same internal type. What do you need it for?
LucaMs Expert Licensed User Longtime User Jul 10, 2016 #3 If you needed only to know: Roberto P. said: If CallBack Is Activity Then Click to expand... maybe you can use (or adapt) this routine (it is from module Scale): Code: 'Returns True If the View v Is an Activity otherwise False 'Needed to check if the view is a Panel or an Activity Public Sub IsActivity(v As View) As Boolean Dim obj As Object obj = GetParent(v) If GetType(obj) = "android.widget.FrameLayout" Then Return True Else Return False End If End Sub Upvote 0
If you needed only to know: Roberto P. said: If CallBack Is Activity Then Click to expand... maybe you can use (or adapt) this routine (it is from module Scale): Code: 'Returns True If the View v Is an Activity otherwise False 'Needed to check if the view is a Panel or an Activity Public Sub IsActivity(v As View) As Boolean Dim obj As Object obj = GetParent(v) If GetType(obj) = "android.widget.FrameLayout" Then Return True Else Return False End If End Sub
Erel B4X founder Staff member Licensed User Longtime User Jul 10, 2016 #4 It might not be correct in all cases. Upvote 0
Roberto P. Well-Known Member Licensed User Longtime User Jul 11, 2016 #5 Erel said: It is difficult to distinguish between activities and panels because both of them are based on the same internal type. What do you need it for? Click to expand... I need to know what is the parent class of the object, to make the correct cast with the subject "vCallback" So, how do I know which class an object belongs? I hope it is clear Upvote 0
Erel said: It is difficult to distinguish between activities and panels because both of them are based on the same internal type. What do you need it for? Click to expand... I need to know what is the parent class of the object, to make the correct cast with the subject "vCallback" So, how do I know which class an object belongs? I hope it is clear
Erel B4X founder Staff member Licensed User Longtime User Jul 11, 2016 #6 Roberto P. said: I need to know what is the parent class of the object, to make the correct cast with the subject "vCallback" Click to expand... Please post the code where you need to know the class type. Upvote 0
Roberto P. said: I need to know what is the parent class of the object, to make the correct cast with the subject "vCallback" Click to expand... Please post the code where you need to know the class type.