R RB Smissaert Well-Known Member Licensed User Longtime User Jul 10, 2025 #1 In a B4XPages project I sometimes run a progressbar by drawing a line on a B4XCanvas that is initialized on a B4XView. I noticed that when this progressbar is running and I move way from the app and then return to it, the progressbar is not visible anymore. All else is working fine. The solution to this seems to be to initialize the B4XCanvas in Sub B4XPage_Appear: Code: Copy Sub Class_Globals Private lblPatMap As B4XView Private cvsLabelProgress As B4XCanvas End Sub Sub Sub B4XPage_Appear cvsLabelProgress.Initialize(lblPatMap) End Sub Is this the right way? RBS
In a B4XPages project I sometimes run a progressbar by drawing a line on a B4XCanvas that is initialized on a B4XView. I noticed that when this progressbar is running and I move way from the app and then return to it, the progressbar is not visible anymore. All else is working fine. The solution to this seems to be to initialize the B4XCanvas in Sub B4XPage_Appear: Code: Copy Sub Class_Globals Private lblPatMap As B4XView Private cvsLabelProgress As B4XCanvas End Sub Sub Sub B4XPage_Appear cvsLabelProgress.Initialize(lblPatMap) End Sub Is this the right way? RBS
Cableguy Expert Licensed User Longtime User Jul 10, 2025 #2 Why a canvas? You can achieve the same behaviour with a panel Upvote 0
R RB Smissaert Well-Known Member Licensed User Longtime User Jul 10, 2025 #3 Cableguy said: Why a canvas? You can achieve the same behaviour with a panel Click to expand... Just because the label is already there, just in the right place and with the right dimensions. I could add a panel, but it seems to work all fine now. I have another progressbar, more elaborate, taking up more space, but that wasn't suitable in this case. RBS Upvote 0
Cableguy said: Why a canvas? You can achieve the same behaviour with a panel Click to expand... Just because the label is already there, just in the right place and with the right dimensions. I could add a panel, but it seems to work all fine now. I have another progressbar, more elaborate, taking up more space, but that wasn't suitable in this case. RBS
Erel B4X founder Staff member Licensed User Longtime User Jul 13, 2025 #4 This is the not correct solution. The canvas will never become uninitialized because of the app moving to the background. The problem is somewhere else. Maybe you are calling Canvas.Release somewhere or initializing it again. Upvote 0
This is the not correct solution. The canvas will never become uninitialized because of the app moving to the background. The problem is somewhere else. Maybe you are calling Canvas.Release somewhere or initializing it again.