Hello
I am using this code snippet to scale a panel : panelana in my project.
this code also centers the panel with adjusting the scaled panel. ( en and boy is 100%x and 100%y which means width and height )
To give you an idea about it this is the ss of my visual designer:
the outer pink panel is the panelana which i scale and the main activity screen consists buttons and menus. Some action is going on on the panelana ( the pink one ) so when the user click on zoom out :
nearly all the pink panel : panelana is fitted into activity.
My problem is when i change the scale , I cant find out the correct left,top values of the pink panel which i scaled. For example i want to create a label in scaled panel between the left and right value of the activity , but because the scaled panel is scaled , everything is mixed. What is the correct way of doing this . ? I know , I described it bad but i hope you can understand .
I am using this code snippet to scale a panel : panelana in my project.
B4X:
Sub ScalePanel(pnl As Panel, factor As Float)
Dim jo As JavaObject = pnl
jo.RunMethod("setScaleX", Array(factor))
jo.RunMethod("setScaleY", Array(factor))
pnl.Top=pnl.Top+((currentscale-factor)*boy)
pnl.left=pnl.left+((currentscale-factor)*en)
currentscale=factor
end sub
this code also centers the panel with adjusting the scaled panel. ( en and boy is 100%x and 100%y which means width and height )
To give you an idea about it this is the ss of my visual designer:
the outer pink panel is the panelana which i scale and the main activity screen consists buttons and menus. Some action is going on on the panelana ( the pink one ) so when the user click on zoom out :
B4X:
ScalePanel(panelana,0.55)
nearly all the pink panel : panelana is fitted into activity.
My problem is when i change the scale , I cant find out the correct left,top values of the pink panel which i scaled. For example i want to create a label in scaled panel between the left and right value of the activity , but because the scaled panel is scaled , everything is mixed. What is the correct way of doing this . ? I know , I described it bad but i hope you can understand .