# Programming UI: Problem!

**URL:** https://forum.highend3d.com/t/programming-ui-problem/6458
**Category:** Maya
**Tags:** mel
**Created:** [February 20, 2002, 7:52pm UTC](https://forum.highend3d.com/t/programming-ui-problem/6458 "2002-02-20T19:52:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![slothuus](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/s/c0e974/32.png) [@slothuus](https://forum.highend3d.com/u/slothuus)
#### Post date: [February 20, 2002, 7:52pm UTC](https://forum.highend3d.com/t/programming-ui-problem/6458/1 "2002-02-20T19:52:13Z")

</div>

Hi,   
What do I have to do in order to parent a tabLayout to a FrameLayout??  
here is my approach but it gives me an error message:

* * *

window -widthHeight 200 150;  
string $main = `formLayout`;  
 string $tabs = `tabLayout -innerMarginWidth 5 -innerMarginHeight 5`;

```
        formLayout -edit
    		-attachForm $tabs "top" 0
 		-attachForm $tabs "left" 0
 		-attachForm $tabs "bottom" 0
 		-attachForm $tabs "right" 0
 		$main;

 	//string $child1 = `rowColumnLayout`;
 	 string $child1 = `formLayout`;
 	 	string $b1 = `button`;
 		string $b2 = `button`;	
 		string $frame1=`frameLayout -la "top" -bs "in" -cll true`; //This DOESN'T WORK [img]http://208.179.92.68/forums/icons/frown.gif[/img]

		setParent ..; 		

 	formLayout -edit
 		-attachForm $b1 "top" 0
 		-attachForm $b1 "left" 0
 		-attachPosition $b1 "right" 0 50
 		-attachForm $b1 "bottom" 0

 		-attachForm $b2 "top" 0
 		-attachControl $b2 "left" 0 $b1
 		-attachForm $b2 "right" 0
 		-attachForm $b2 "bottom" 0
 		-attachForm $frame1 "top" 20	 			 		
 		$child1;

 	string $child2 = `formLayout`;
	 	string $b3 = `button`;
 		string $b4 = `button`;
 		 setParent ..;

 	formLayout -edit
 		-attachForm $b3 "top" 0
 		-attachForm $b3 "left" 10
 		-attachPosition $b3 "right" 0 45
 		-attachForm $b3 "bottom" 0

 		-attachForm $b4 "top" 0
 		-attachControl $b4 "left" 10 $b3
 		-attachForm $b4 "right" 10
 		-attachForm $b4 "bottom" 0
 		$child2;

 	tabLayout -edit
 		-tabLabel $child1 "One"
 		-tabLabel $child2 "Two"
	$tabs;
```

I get the following error message:  
Object is not a child: MainWindow|formLayout147|tabLayout7|formLayout148|formLayout149

* * *

May be somebody could help!!

Cheers  
Mel

---

<div class="post-metadata">

### Author: ![jeffd](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/71c47a/32.png) [@jeffd](https://forum.highend3d.com/u/jeffd)
#### Post date: [February 21, 2002, 5:27am UTC](https://forum.highend3d.com/t/programming-ui-problem/6458/2 "2002-02-21T05:27:40Z")

</div>

I don't have Maya in front of me right now, but my initial impression is that this is going to be tracked down to not having enough setParent..; commands in the right places. Every time you go a level deeper in a UI by adding another layout type, you need to make sure you step back up with setParent. My initial guess would be before the $child2 formLayout.

I will try and remember to fire this up in Maya tomorrow at the office and see if I can get it to run.

--JeffD

---

<div class="post-metadata">

### Author: ![carmine-1](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/c/97f17d/32.png) [@carmine-1](https://forum.highend3d.com/u/carmine-1)
#### Post date: [February 22, 2002, 9:43am UTC](https://forum.highend3d.com/t/programming-ui-problem/6458/3 "2002-02-22T09:43:35Z")

</div>

You've probably solved this already, but if not:

I find the easiest way not to get my SetParents in a twist is to use the "-p" flag to make sure that my layouts have the correct parents. I tried out what you pasted, and could make it work by setting the parenting like this.

Carmine  
xxxxxxx
