Just checking that you know that you can refer to the Activity width (effectively the screen width) as 100%x. So if you want to set a panel's width to half the screen width you set pnl.width = 50%x and so on.
Edit : This is probably only relevant if you are using a Designer Script, but I thought that might be the case here.