Android Question How to change a panel size dinamically

jesustarre

Member
Licensed User
Longtime User
Hello, World!

I have a Panel defined on the designer with a specific <Width> and <Height>, I need change that size depending on an action.

For Example:


B4X:
Sub Globals
      Dim Panel1 As Panel
      Dim Button1, Button2 As Button
End Sub
...

Sub Button1_Click
      panel1.Width  = 100%x
      panel1.Height = 100%y
End Sub

Sub Button2_Click
      panel1.Width  = 5%x
      panel1.Height = 5%y
End Sub

But for some reason does not change the Width and Height

On the Designer the Panel2 Width=1 and Height=1

Thanks in advance for any help
 

jesustarre

Member
Licensed User
Longtime User
Well, now I have question for you, is it Panel1 or Panel2?, look at the code you posted, besides, you DON'T have to initialize views created with the designer.
Sorry, that's just a sample, It's panel1
Yes, Panel1 does not initialize because was created with the designer

I'm gonna keep trying. Thanks Buddy
 
Upvote 0

dkerr

New Member
Licensed User
Longtime User
Hello, World!

I have a Panel defined on the designer with a specific <Width> and <Height>, I need change that size depending on an action.

For Example:


B4X:
Sub Globals
      Dim Panel1 As Panel
      Dim Button1, Button2 As Button
End Sub
...

Sub Button1_Click
      panel1.Width  = 100%x
      panel1.Height = 100%y
End Sub

Sub Button2_Click
      panel1.Width  = 5%x
      panel1.Height = 5%y
End Sub

But for some reason does not change the Width and Height

On the Designer the Panel2 Width=1 and Height=1

Thanks in advance for any help
 
Upvote 0

RandomCoder

Well-Known Member
Licensed User
Longtime User
Are you certain that the Button events are being triggered? Use a breakpoint within each event and run in debug mode. My money is on the event not being raised.
 
Upvote 0
Top