jinyistudio Well-Known Member Licensed User Longtime User Jan 23, 2015 #1 Hi I want to put a panel(fixed size) into the central of screen but i don't know get current screen width & height. Could you tell me how to do it ?
Hi I want to put a panel(fixed size) into the central of screen but i don't know get current screen width & height. Could you tell me how to do it ?
Mark Read Well-Known Member Licensed User Longtime User Jan 23, 2015 #2 Activity.Width or Activity.Height Upvote 0
jinyistudio Well-Known Member Licensed User Longtime User Jan 23, 2015 #3 mark35at said: Activity.Width or Activity.Height Click to expand... My current code but the result of n1,n2 are zero Sub ShowPopupMenu(bShow As Boolean) Dim n1,n2 As Int n1 = (Activity.Width -Panel1.Width) Mod 2 n2 = (Activity.Height-Panel1.Height) Mod 2 Panel1.Left = n1 Panel1.Top = n2 Panel1.Visible = bShow End Sub Upvote 0
mark35at said: Activity.Width or Activity.Height Click to expand... My current code but the result of n1,n2 are zero Sub ShowPopupMenu(bShow As Boolean) Dim n1,n2 As Int n1 = (Activity.Width -Panel1.Width) Mod 2 n2 = (Activity.Height-Panel1.Height) Mod 2 Panel1.Left = n1 Panel1.Top = n2 Panel1.Visible = bShow End Sub
jinyistudio Well-Known Member Licensed User Longtime User Jan 23, 2015 #4 jinyistudio said: My current code but the result of n1,n2 are zero Sub ShowPopupMenu(bShow As Boolean) Dim n1,n2 As Int n1 = (Activity.Width -Panel1.Width) Mod 2 n2 = (Activity.Height-Panel1.Height) Mod 2 Panel1.Left = n1 Panel1.Top = n2 Panel1.Visible = bShow End Sub Click to expand... Attachments Noname.png 41.7 KB · Views: 306 Upvote 0
jinyistudio said: My current code but the result of n1,n2 are zero Sub ShowPopupMenu(bShow As Boolean) Dim n1,n2 As Int n1 = (Activity.Width -Panel1.Width) Mod 2 n2 = (Activity.Height-Panel1.Height) Mod 2 Panel1.Left = n1 Panel1.Top = n2 Panel1.Visible = bShow End Sub Click to expand...
jinyistudio Well-Known Member Licensed User Longtime User Jan 23, 2015 #5 Using following is OK, Thank's Private lv As LayoutValues lv = Activity.LoadLayout("bluelt_main") Sub ShowPopupMenu(bShow As Boolean) Dim n1,n2 As Int n1 = (lv.Width -Panel1.Width) / 2 n2 = (lv.Height-Panel1.Height) / 2 Panel1.Left = n1 Panel1.Top = n2 Panel1.Visible = bShow End Sub Upvote 0
Using following is OK, Thank's Private lv As LayoutValues lv = Activity.LoadLayout("bluelt_main") Sub ShowPopupMenu(bShow As Boolean) Dim n1,n2 As Int n1 = (lv.Width -Panel1.Width) / 2 n2 = (lv.Height-Panel1.Height) / 2 Panel1.Left = n1 Panel1.Top = n2 Panel1.Visible = bShow End Sub
eurojam Well-Known Member Licensed User Longtime User Jan 23, 2015 #6 you have to assign your panel to the activity or any parent view before you can calculate any values with it. that the reason for the error you got. While loading the layout, the panel is assigned and you will get your values... Upvote 0
you have to assign your panel to the activity or any parent view before you can calculate any values with it. that the reason for the error you got. While loading the layout, the panel is assigned and you will get your values...
Erel B4X founder Staff member Licensed User Longtime User Jan 25, 2015 #7 Use designer script and set its HorizontalCenter to 50%x and VerticalCenter to 50%y. Upvote 0