S salmander Active Member Licensed User Longtime User Jun 21, 2012 #1 Hi All, I have a panel as panel1. In the panel i have button1 and button2. But this code doesn't seem to work for me in Designer Script Code: Panel1.SetLeftAndRight(0, 100%x) Panel1.Bottom = 89%y Button1.Top = Panel1.Top Button2.Bottom = Panel1.Bottom The buttons disappear from the Panel. Anyone knows what I am doing wrong here?
Hi All, I have a panel as panel1. In the panel i have button1 and button2. But this code doesn't seem to work for me in Designer Script Code: Panel1.SetLeftAndRight(0, 100%x) Panel1.Bottom = 89%y Button1.Top = Panel1.Top Button2.Bottom = Panel1.Bottom The buttons disappear from the Panel. Anyone knows what I am doing wrong here?
NJDude Expert Licensed User Longtime User Jun 21, 2012 #2 Try this: Code: Panel1.SetLeftAndRight(0, 100%x) Panel1.Height = 89%y Button1.Top = Panel1.Top Button2.Bottom = Panel1.Bottom Upvote 0
Try this: Code: Panel1.SetLeftAndRight(0, 100%x) Panel1.Height = 89%y Button1.Top = Panel1.Top Button2.Bottom = Panel1.Bottom
S salmander Active Member Licensed User Longtime User Jun 21, 2012 #3 Thanks for your reply NJDude. It doesn't seems to work either. The button2, is only half way on panel1. And secondly, I don't wish to resize my panel. I just want to set the panel1.bottom should be at the 89% of the Activity, which is working fine. But the views inside doesn't gets re-aligned in relation to the panel. The button1 should appear at the top of the panel and button2 should appear at the bottom of the panel. Is this a bug? Upvote 0
Thanks for your reply NJDude. It doesn't seems to work either. The button2, is only half way on panel1. And secondly, I don't wish to resize my panel. I just want to set the panel1.bottom should be at the 89% of the Activity, which is working fine. But the views inside doesn't gets re-aligned in relation to the panel. The button1 should appear at the top of the panel and button2 should appear at the bottom of the panel. Is this a bug?
NJDude Expert Licensed User Longtime User Jun 21, 2012 #4 I see what you mean, hmmmm, maybe is a bug. Upvote 0
S salmander Active Member Licensed User Longtime User Jun 21, 2012 #5 hmmm strange! It's sad. I only started using designer scripts and found this behaviour Lets see what Erel has to say about this. Hope to find a viable solution soon. peace NJDude Upvote 0
hmmm strange! It's sad. I only started using designer scripts and found this behaviour Lets see what Erel has to say about this. Hope to find a viable solution soon. peace NJDude
Erel B4X founder Staff member Licensed User Longtime User Jun 21, 2012 #6 The buttons disappear from the Panel. Anyone knows what I am doing wrong here? Click to expand... Yes. The button coordinates are relative to the panel (its parent). You should change your code to: Code: Button1.Top = 0 Button2.Bottom = Panel1.Height Note that this code is logically wrong as you are first setting the Top property and then the Bottom property. The button's height will not change. If you want the button to fill the panel then you should use: Code: Button1.SetTopAndButtom(0, Panel1.Height) Upvote 0
The buttons disappear from the Panel. Anyone knows what I am doing wrong here? Click to expand... Yes. The button coordinates are relative to the panel (its parent). You should change your code to: Code: Button1.Top = 0 Button2.Bottom = Panel1.Height Note that this code is logically wrong as you are first setting the Top property and then the Bottom property. The button's height will not change. If you want the button to fill the panel then you should use: Code: Button1.SetTopAndButtom(0, Panel1.Height)
NJDude Expert Licensed User Longtime User Jun 21, 2012 #7 I've learned something new today about Designer Scripts. Thanks. Upvote 0
S salmander Active Member Licensed User Longtime User Jun 21, 2012 #8 Erel said: Yes. The button coordinates are relative to the panel (its parent). You should change your code to: Code: Button1.Top = 0 Button2.Bottom = Panel1.Height Click to expand... I understand the Button1.top = 0 But, why isn't button2.bottom = panel1.bottom right? As I am setting the bottom property of button2 to whatever it is of panel1. For e.g: If panel1.bottom = 300 then button2.bottom will be equal to 300. Therefore, the button2 should appear right at the end of the panel (without changing the height of the button). Note that this code is logically wrong as you are first setting the Top property and then the Bottom property. Click to expand... Why is it logically wrong? I am setting the bottom and top properties of two different buttons here. The button's height will not change. Click to expand... I am not trying to change the height of the button. I am changing to position of the buttons relative to the panels position. If you want the button to fill the panel then you should use: Code: Button1.SetTopAndButtom(0, Panel1.Height) Click to expand... cheers Erel Upvote 0
Erel said: Yes. The button coordinates are relative to the panel (its parent). You should change your code to: Code: Button1.Top = 0 Button2.Bottom = Panel1.Height Click to expand... I understand the Button1.top = 0 But, why isn't button2.bottom = panel1.bottom right? As I am setting the bottom property of button2 to whatever it is of panel1. For e.g: If panel1.bottom = 300 then button2.bottom will be equal to 300. Therefore, the button2 should appear right at the end of the panel (without changing the height of the button). Note that this code is logically wrong as you are first setting the Top property and then the Bottom property. Click to expand... Why is it logically wrong? I am setting the bottom and top properties of two different buttons here. The button's height will not change. Click to expand... I am not trying to change the height of the button. I am changing to position of the buttons relative to the panels position. If you want the button to fill the panel then you should use: Code: Button1.SetTopAndButtom(0, Panel1.Height) Click to expand... cheers Erel
Erel B4X founder Staff member Licensed User Longtime User Jun 21, 2012 #9 Why is it logically wrong? Click to expand... Oops. Didn't see that these are two different buttons. But, why isn't button2.bottom = panel1.bottom right? Click to expand... Lets say that Panel1.Top = 200 and Panel1.Bottom = 500 (Panel1.Height = 300). When you set Button2.Bottom = Panel1.Bottom you are setting Button2.Bottom = 500 However Button2 is a child of Panel1. So 500 is relative to Panel1. As Panel1 height is only 300, Button2 will be hidden. If you think of it, this is exactly the same reason that Button1.Top = 0 is correct. Upvote 0
Why is it logically wrong? Click to expand... Oops. Didn't see that these are two different buttons. But, why isn't button2.bottom = panel1.bottom right? Click to expand... Lets say that Panel1.Top = 200 and Panel1.Bottom = 500 (Panel1.Height = 300). When you set Button2.Bottom = Panel1.Bottom you are setting Button2.Bottom = 500 However Button2 is a child of Panel1. So 500 is relative to Panel1. As Panel1 height is only 300, Button2 will be hidden. If you think of it, this is exactly the same reason that Button1.Top = 0 is correct.
S salmander Active Member Licensed User Longtime User Jun 21, 2012 #10 ohhh I see. Thanks a lot Erel. Upvote 0