iOS Question Button height and width doesn't change at runtime

Alessandra Pellegri

Active Member
Licensed User
Longtime User
I am sorry for this question but on internet I cannot find anything about it.
When I change widht or height or position of my buttons at runtime, nothing happens.

Could you tell me why ?

Thank you
 

Alessandra Pellegri

Active Member
Licensed User
Longtime User
I see now that it doesn't work just if i modify width or heigh in Application_Start. If I do it in Button1_click it works.
Here my code:
B4X:
Private Sub Application_Start (Nav As NavigationController)
   NavControl = Nav
   Page1.Initialize("Page1")
   Page1.RootPanel.LoadLayout("prima")
   impostaLayout
   impostaImmaginipulsanti   
   Page1.Title = "Page 1"
   Page1.RootPanel.Color = Colors.White
   NavControl.ShowPage(Page1)   
End Sub

Sub Button1_Click
   If WebView2.Visible=False Then
     WebView2.Visible=True
     WebView2.Width=200dip
     impostaLayout
   Else
     WebView2.Visible=False
     WebView2.Width=0
   End If
End Sub

Sub impostaLayout
   Dim dimButton As Int =  60dip
   Dim dimTextBox As Int = 60dip
   Panel1.Width=Round(GetDeviceLayoutValues.Width/2)
     ListView1.Width=Panel1.Width
     'ListView1.SingleLineLayout.Label.TextSize=convertFromDp(20)
     'ListView1.SingleLineLayout.Label.TextColor=Colors.Black
     EditText2.TextColor=Colors.Black
     EditText2.Left=0
     EditText2.Width=Panel1.Width     
     'EditText2.TextSize=convertFromDp(20)
     EditText2.Height=40dip         
     EditText2.Top=0
     CheckBox2.Top=EditText2.Height
     'CheckBox2.TextSize=convertFromDp(20)
     Button5.Width=dimButton
     Button4.Width=dimButton
     Button5.Height=dimButton
     Button4.Height=dimButton
     Button4.Left=0
     'Button4.TextSize=convertFromDp(20)
     'Button5.TextSize=convertFromDp(20)
     Button4.Top=EditText2.Height+CheckBox2.Height
     Button5.Top=EditText2.Height+CheckBox2.Height
     Button5.Left=Panel1.Width-Button5.Width
     Button5.Left=Panel1.Width-Button5.Width
   Panel2.Width=Panel1.Width
     ListView4.Width=Panel2.Width
     Button7.Width=dimButton
     Button8.Width=dimButton
     Button7.Height=dimButton
     Button8.Height=dimButton
     'Button7.TextSize=convertFromDp(20)
     'Button8.TextSize=convertFromDp(20)
     ListView4.Top=Button7.Height
     Button8.Left=0
     Button7.Left=Panel2.Width-Button7.Width   
     'ListView4.SingleLineLayout.Label.TextSize=convertFromDp(20)
     'ListView4.SingleLineLayout.Label.TextColor=Colors.Black
   Button1.Height=dimButton
   Button1.Width=dimButton
   Button2.Height=dimButton
   Button2.Width=dimButton
   Button3.Height=dimButton
   Button3.Width=dimButton
   Button6.Width=dimButton
   Button6.Height=dimButton
   Button9.Width=dimButton
   Button9.Height=dimButton
   Button10.Height=dimButton
   Button10.Width=dimButton
     
   Button9.Left=Button2.Left-Button9.Width   
   Button10.Left=Button6.Left+Button6.Width
   Label1.Height=40dip
   Label1.Left=Button10.Left+Button10.Width
   
   Button6.Left=Button3.Left+Button3.Width

   EditText1.Height=dimTextBox
   EditText1.Left=Button10.left+Button10.Width
   EditText1.Width=Button9.Left-EditText1.Left
   'EditText1.TextSize=convertFromDp(40)
   
   'Button1.TextSize=convertFromDp(20)
   'Button2.TextSize=convertFromDp(20)
   'Button3.TextSize=convertFromDp(20)
   'Button6.TextSize=convertFromDp(20)
   'Label1.TextSize=convertFromDp(20)
   WebView1.Height=WebView1.Height+(WebView1.Top-Button1.Height)
   WebView1.Top=Button1.Height
   WebView2.Top=WebView1.Top
   WebView2.Height=WebView1.Height
   Panel1.Top=WebView1.Top
   Panel2.Top=WebView1.Top
   Panel1.Height=WebView1.Height
   Panel2.Height=WebView1.Height
   'WebView1.JavaScriptEnabled=True
   Button9.Enabled=False
   
   'ListView2.SingleLineLayout.Label.TextSize=convertFromDp(20)
   'ListView3.SingleLineLayout.Label.TextSize=convertFromDp(20)
End Sub

impostaLayout is called in Application_start but it appears that it doesn't execute. Instead when I press Button1 al buttons go in their palce.

Why this ?

Thank you
 
Upvote 0
Top