how can i add a button or any other control dynamically (by code)?
how can i add a button or any other control dynamically (by code)?
I don't think that's possible (yet?).
I personally would especially like that in a Flex enabled container, because Flex is easier to use (regarding positioning) when adding controls dynamically.
@Marc I don't think that's possible (yet?).
I personally would especially like that in a Flex enabled container, because Flex is easier to use (regarding positioning) when adding controls dynamically.
I discovered. If you use a View, you can use addSubView to add.
func Load(): var pb=Button(ButtonType.RoundedRect); pb.title="TEST"; pb.backgroundColor=Color("a9aaaa"); self.addSubview(pb);
@Luiz D'Aniello I discovered. If you use a View, you can use addSubView to add.
func Load(): var pb=Button(ButtonType.RoundedRect); pb.title="TEST"; pb.backgroundColor=Color("a9aaaa"); self.addSubview(pb);
Ah, of course. I only checked the Creo View class and forgot to look at the parent classes (duh ...). But still, from my experience, I think using Flex would be much easier for positioning than using lay-out constraints from code.