Bug? Custom views are not views

Informatix

Expert
Licensed User
Longtime User
When you create a custom view with B4A v5.8 (menu Project > Add new module > Class module > CustomView), this "view" is not really a view, so you get an error when you do things like:
Dim MyView As clsMyCustomView = MyPanel.GetView(0)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is not a bug. CustomViews are not views. This was always the case.

One way to get a reference to clsMyCustomView instance is by adding it as a tag to the base panel (or the main view if you are not using the base panel):

B4X:
Sub DesignerCreateView (...)
Base.Tag = Me
...
End Sub
B4X:
Dim MyView As clsMyCustomView = MyPanel.GetView(0).Tag
 

Informatix

Expert
Licensed User
Longtime User
I'm so used to Java for my custom views that I have no experience with custom views in B4A. Thanks for the tip.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…