JeffT Member Licensed User Sep 10, 2020 #1 In a routine that performs an undo, by opening a 'last known good' file from internal storage I use B4X: Pane1.SetVisibleAnimated (500,false) 'do the file related work Pane1.SetVisibleAnimated (500,True) But the Pane does not become visible on the last line. If I call the routine a second time, the Pane does re-appear. What have I missed?
In a routine that performs an undo, by opening a 'last known good' file from internal storage I use B4X: Pane1.SetVisibleAnimated (500,false) 'do the file related work Pane1.SetVisibleAnimated (500,True) But the Pane does not become visible on the last line. If I call the routine a second time, the Pane does re-appear. What have I missed?
Erel B4X founder Staff member Licensed User Longtime User Sep 10, 2020 #2 1. I hope that Pane1 type is B4XView. 2. You forgot that SetVisibleAnimated is an async method: Code: Pane1.SetVisibleAnimated (500,false) 'do the file related work Sleep(500) Pane1.SetVisibleAnimated (500,True) Upvote 0
1. I hope that Pane1 type is B4XView. 2. You forgot that SetVisibleAnimated is an async method: Code: Pane1.SetVisibleAnimated (500,false) 'do the file related work Sleep(500) Pane1.SetVisibleAnimated (500,True)
JeffT Member Licensed User Sep 10, 2020 #3 1. I hope that Pane1 type is B4XView. It is 2. You forgot that SetVisibleAnimated is an async method: Not forgot - not aware. Im guessing that the effect is that the first call does what it likes, and the second call may be trying to do what it does , while the first is still operating. Is there a way to make one wait for the other to complete, or to call it with a delayed start? Upvote 0
1. I hope that Pane1 type is B4XView. It is 2. You forgot that SetVisibleAnimated is an async method: Not forgot - not aware. Im guessing that the effect is that the first call does what it likes, and the second call may be trying to do what it does , while the first is still operating. Is there a way to make one wait for the other to complete, or to call it with a delayed start?
Erel B4X founder Staff member Licensed User Longtime User Sep 10, 2020 #4 Yes. Add Sleep(500). Note that Sleep is not a blocking call. This is the resumable subs feature. Upvote 0
JeffT Member Licensed User Sep 10, 2020 #5 B4X: Pane1.SetVisibleAnimated (500,false) 'do the file related work Sleep(500) Pane1.SetVisibleAnimated (500,True) Sadly, same result. There is a small delay, the pane fades to black, but doesnt come back. I'll think of some other way to show busy. Upvote 0
B4X: Pane1.SetVisibleAnimated (500,false) 'do the file related work Sleep(500) Pane1.SetVisibleAnimated (500,True) Sadly, same result. There is a small delay, the pane fades to black, but doesnt come back. I'll think of some other way to show busy.
Erel B4X founder Staff member Licensed User Longtime User Sep 11, 2020 #6 Best if you upload a small project with this code. It should work. Upvote 0
JohnC Expert Licensed User Longtime User Dec 12, 2022 #7 JeffT said: B4X: Pane1.SetVisibleAnimated (500,false) 'do the file related work Sleep(500) Pane1.SetVisibleAnimated (500,True) Sadly, same result. There is a small delay, the pane fades to black, but doesnt come back. I'll think of some other way to show busy. Click to expand... Try changing the Sleep(500) to sleep (1000) and see if it works. My hunch is that the first animation has to complete before a new one will work, and setting the animation time to 500ms and the delay to 500ms is to close for comfort. Upvote 0
JeffT said: B4X: Pane1.SetVisibleAnimated (500,false) 'do the file related work Sleep(500) Pane1.SetVisibleAnimated (500,True) Sadly, same result. There is a small delay, the pane fades to black, but doesnt come back. I'll think of some other way to show busy. Click to expand... Try changing the Sleep(500) to sleep (1000) and see if it works. My hunch is that the first animation has to complete before a new one will work, and setting the animation time to 500ms and the delay to 500ms is to close for comfort.