KCButton is not a Node, so you cannot add it directly.
You can expose pnlBase and add it (or create an AsNode sub that returns pnlBase). However you will also need to initialize it and set its properties.
Not all custom views should be "code supported". Developers can always add them with a pane and a call to LoadLayout.
This means that the principle in B4J is different than in B4A.
I made a same CustomView class in B4A where I can add the CustomView in the code.
The goal of these CustomViews is to have the same code in both B4A and B4J and probably B4i.
Attached the B4A Class.
Hi Erel,
Sorry for having bothered you !
I did the same approch like in B4A and had the AddToParent routine in the B4J Class, but I didn't use it !?
Don't know why i tryed to add the CustomView like a 'standard' Node. This approch doesn't work in B4A either.
Sometimes I can't see the forest for the trees and need the eyes of someone else.