if the button is a child of panel2 and panel 2 is the child of panel 1 you can get the top and left value of the button according to main page with stg like :
panel1.top+panel2.top+button1.top which means if panel1's top is 40 and inside panel 1 , panel2's top is 50 and inside panel 2 , button1's top is 20 then , button1's top according to main view is 110.
if the button is a child of panel2 and panel 2 is the child of panel 1 you can get the top and left value of the button according to main page with stg like :
panel1.top+panel2.top+button1.top which means if panel1's top is 40 and inside panel 1 , panel2's top is 50 and inside panel 2 , button1's top is 20 then , button1's top according to main view is 110.