Android Question Custom View "AddToParent" method implementation

Cableguy

Expert
Licensed User
Longtime User
Hi guys

I'm trying to implement an "AddToParent" method but I keep hitting walls

I want my sub declaration as this
Code: Copy
Sub AddToParent( v as panel, Left as int, Top as Int, Height as int, Width as int)

my initial approach was like this

Code: Copy
    mBase.Initialize("") 'CustomView Base Panel
    mBase.RemoveView
    v.AddView(mBase, Left, Top, Width, Height
This is a custom view with designer support


but I get all sort of errors... Please help
 
Last edited:
Why do you need to sub? Usually you will want to add the view in the DesignerCreateView sub.

the Idea was to be able to add the view by code, wish I have successfully implemented in my NumUpDown v1.5
 
Upvote 0
Have a look at chapter 11.6 Display a custom view in the Designer in the User's Guide.
In he ClsLimitBar2 example code the CusromView can be added either in the Designer or in the code.

It uses four routines:
The standard routines.
Initialize
DesignerCreateView

And two addition routines:
AddView, adds the view to the parent
Init, initialisation routine called either by DesignerCreateView or AddView.
 
Last edited:
Upvote 0
Thanks @klaus I'll have to refresh myself with the user manual again as I too could do with knowing how to do add designer support to a class I'm currently working on.
 
Upvote 0
Take a look at chapter 11.6 Display a custom view in the Designer in the User's Guide.
In he ClsLimitBar2 example code the CusromView can be added either in the Designer or in the code.

It uses four routines:
The standard routines.
Initialize
DesignerCreateView

And two addition routines:
AddView, adds the view to the parent
Init, initialisation routine called either by DesignerCreateView or AddView.

I did and that is why/how I managed to implement the "AddToParent" method to my NumUpDown.
Many thanks to you @klaus
 
Upvote 0
Back
Top