Compile Error: Label1.Parent "Unknown member Parent"

Widget

Well-Known Member
Licensed User
Longtime User
If I have

Sub Globals
dim Label1 as Label
...

Then later on:

Label1.Parent = Panel2

I will get a compile error saying it doesn't know what "Parent" is.
Why? The Designer shows a Parent property in the Designer for Label1.

I want to create labels dynamically and display them on a particular panel, but I can't get by this simple example. Am I doing something wrong?:confused:

TIA
Widget
 

kickaha

Well-Known Member
Licensed User
Longtime User
You need to add the label to the panel using
B4X:
Panel2.AddView (Label1,Left, Top, Width, Height)
Obviously replace Left, Top, Width and Height with appropriate values.
 
Upvote 0

francoisg

Active Member
Licensed User
Longtime User
Can you actually get the parent property of a view??? I can't seem to find it (maybe I am doing something wrong?)!!!
Need it in order to create a generic function that need to know what the parent of the sender view is!!!
 
Upvote 0

francoisg

Active Member
Licensed User
Longtime User
Already used the Tag property for something else (running out of properties here - have to use a new type to store multiple values in the Tag),
Thank you anyway ...
 
Upvote 0
Top