Strange Problem

adolleschal

Member
Licensed User
Longtime User
I create a Panel on the bottom of my Activity to display a ProgressBar for a Background Thread. This works as expected, but as soon if i switch from Landscape to Portrait Mode and vice versa the Panel is not shown anymore?

B4X:
Sub Globals
   Dim ActivityPanel As Panel

   Dim ProgressPanel As Panel
   Dim ProgressInfo As ProgressBar
   Dim infoLabel As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
   ActivityPanel.Initialize("")
   Activity.AddView(ActivityPanel, 0, 0, 100%x, 100%y)

   CreateProgressPanel 'Create the Progress Panel
End Sub

Sub CreateProgressPanel
   Log("Creating Progresspanel at " & (ActivityPanel.Height - 100))
   
   ProgressPanel.Initialize("")
   ProgressPanel.Color = Colors.White
   ProgressPanel.Visible = False
   
   ProgressInfo.Initialize("")
   ProgressInfo.Progress = 0

   infoLabel.Initialize("")
   infoLabel.TextColor = Colors.Black
   infoLabel.Text = "Loading..."
   infoLabel.TextSize = 14
   infoLabel.Gravity = Gravity.CENTER_HORIZONTAL + Gravity.CENTER_VERTICAL

   ProgressPanel.AddView(ProgressInfo, 25, 20, ActivityPanel.Width - 50, 45)
   ProgressPanel.AddView(infoLabel, 25, 65, ActivityPanel.Width - 50, 18 * LV.Scale)
   ActivityPanel.AddView(ProgressPanel, 0, ActivityPanel.Height - 100, ActivityPanel.Width, 100)
End Sub

Any Idea what could be the problem?

Thanks and best regards
Andreas
 

adolleschal

Member
Licensed User
Longtime User
This is why your posted example doesn't work!
B4X:
ProgressPanel.Visible = False

Sorry, forgot that to remove from the Sample Code. If you remove that or change it to Visible=True it does not work either. (if you switch from landscape to portrait and vice versa)

Best regards
Andreas
 
Upvote 0
Top