Addview, layout etc...

skipsy

Member
Licensed User
Longtime User
Hello,

Does anyone know what's wrong with this :

I have a layout called "Controles"
In this layout, I have a panel called "PNL_Controles"

this code :
B4X:
Dim PNL_CONTROLES As Panel

PNL_CONTROLES.Initialize("")
PNL_CONTROLES.LoadLayout("Controles")
Activity.AddView(PNL_CONTROLES,0,0,100%x,100%y)
Returns error : "The specified child already has a parent.You must call
RemoveView() on the child's parent first" on line Activity.AddView.

If I try changing the name of the panel :
B4X:
Dim PNL_CONT As Panel

PNL_CONT.Initialize("")
PNL_CONT.LoadLayout("Controles")
Activity.AddView(PNL_CONT,0,0,100%x,100%y)
It does nothing... In debugging mode, I can see that PNL_CONT returns
"Layout not available)"

What did I misunderstood ??????

Thks a lot,
WW
 

skipsy

Member
Licensed User
Longtime User
Yes I have a panel called PNL_CONTROLES in the layout .
I have tried to change its name. In this case
B4X:
PNL_CONTROLES.LoadLayout("Controles")
returns "(BALayout):Layout not avalaible" from the debugger.

:BangHead:
 
Upvote 0

skipsy

Member
Licensed User
Longtime User
Hi understand !!!

I mixed up the panel I declare myself in the code and the one created
inside the layout.

:sign0148:

Thk you
WW
 
Upvote 0
Top