S Stichler Active Member Licensed User Aug 9, 2018 #1 Ok essentially I have code that finds the devices width and height defined as : pScreenWidth pScreenHeight Now if possible I want to take Panel1 and set it to match those numbers. I've tried using this code in Designer Scripts with no luck: Panel1.Width = pScreenWidth Panel1.Height = pScreenHeight it does not work. Is what I'm attempting impossible? Should it be done in the Module? Very sorry for all my newb like questions, but you gotta learn somewhere, somehow!
Ok essentially I have code that finds the devices width and height defined as : pScreenWidth pScreenHeight Now if possible I want to take Panel1 and set it to match those numbers. I've tried using this code in Designer Scripts with no luck: Panel1.Width = pScreenWidth Panel1.Height = pScreenHeight it does not work. Is what I'm attempting impossible? Should it be done in the Module? Very sorry for all my newb like questions, but you gotta learn somewhere, somehow!
S Stichler Active Member Licensed User Aug 9, 2018 #2 I figured out I can do it in Module code, but how can I do same in Designer code? Upvote 0
S Stichler Active Member Licensed User Aug 9, 2018 #3 I'm very confused because if I add an Image with no Panel and select Fill it perfectly fits device full screen and width, but no fill option for panels. I'm frustrated lol Upvote 0
I'm very confused because if I add an Image with no Panel and select Fill it perfectly fits device full screen and width, but no fill option for panels. I'm frustrated lol
R RichardN Well-Known Member Licensed User Longtime User Aug 9, 2018 #4 Stich.... Just setting the height and width in code will not fill the screen, simply make the panel the same size as the screen centering it 'who knows where'? In the script: Code: Copy Panel1.SetLeftAndRight(0,100%x) Panel1.SetTopAndBottom(0,100%y) Upvote 0
Stich.... Just setting the height and width in code will not fill the screen, simply make the panel the same size as the screen centering it 'who knows where'? In the script: Code: Copy Panel1.SetLeftAndRight(0,100%x) Panel1.SetTopAndBottom(0,100%y)
S Stichler Active Member Licensed User Aug 9, 2018 #5 Ahh ty! Now lets say I want a button in the middle of that panel and want it to be in the middle of any device that would use the app. What would be best way to go about that? Upvote 0
Ahh ty! Now lets say I want a button in the middle of that panel and want it to be in the middle of any device that would use the app. What would be best way to go about that?
Jeffrey Cameron Well-Known Member Licensed User Longtime User Aug 9, 2018 #6 In the designer there are properties you can use to center the control: Code: Copy btnExit.HorizontalCenter=50%x btnExit.VerticalCenter=50%y If you wish to center it within the panel, then use the containing panel dimensions: Code: Copy btnExit.Left = (panel1.Width - btnExit.Width) / 2 btnExit.Top = (panel1.Height - btnExit.Height) / 2 Upvote 0
In the designer there are properties you can use to center the control: Code: Copy btnExit.HorizontalCenter=50%x btnExit.VerticalCenter=50%y If you wish to center it within the panel, then use the containing panel dimensions: Code: Copy btnExit.Left = (panel1.Width - btnExit.Width) / 2 btnExit.Top = (panel1.Height - btnExit.Height) / 2
S Stichler Active Member Licensed User Aug 9, 2018 #7 I can not thank you both enough!! Ty!!! Upvote 0
Jeffrey Cameron Well-Known Member Licensed User Longtime User Aug 9, 2018 #8 You're very welcome, I also strongly recommend @Erel's Visual Designer tutorial: https://www.b4x.com/etp.html Upvote 0
You're very welcome, I also strongly recommend @Erel's Visual Designer tutorial: https://www.b4x.com/etp.html
klaus Expert Licensed User Longtime User Aug 10, 2018 #9 Instead of Code: Copy Panel1.SetLeftAndRight(0,100%x) Panel1.SetTopAndBottom(0,100%y) You can adjust the Panel to fill the screen and set the anchors to both. You may also have a look at the B4X Booklets. Upvote 0
Instead of Code: Copy Panel1.SetLeftAndRight(0,100%x) Panel1.SetTopAndBottom(0,100%y) You can adjust the Panel to fill the screen and set the anchors to both. You may also have a look at the B4X Booklets.