-
I just checked the 2.6 alpha, and fyne.Container no longer has a lock. How does this work then? What code must go into fyne.Do, and what code can be used outside of fyne.Do? Documetation from the current 2.6 alpha // Do is used to execute a specified function in the main Fyne runtime context without waiting.
// This is required when a background process wishes to adjust graphical elements of a running app.
// Developers should use this only from within goroutines they have created and when the result does not have to
// be waited for. Some examples for code that is called from goroutine:
Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You should use All callbacks from Fyne to your own code are now guaranteed to occur on the "app goroutine" - ie main - so it is never needed to use fyne.Do[AndWait] in your Fyne event handlers/ callbacks. All functions passed to fyne.Do[AndWait] are executed sequentially in the order received. |
Beta Was this translation helpful? Give feedback.
-
@dweymouth can you please confirm that WidgetRenderer methods will be called from the "app goroutine", and there is no need to use fyne.Do and DoWait inside methods that are within renderer methods (Layout, Refresh, MinSize etc.)? |
Beta Was this translation helpful? Give feedback.
You should use
fyne.Do
orfyne.DoAndWait
whenever you are invoking any Fyne APIs other than ones specifically marked as excluded (currently only data binding) from a goroutine that your code created. This includes calling Refresh() as well as setting properties on widgets, CanvasObjects, etc.All callbacks from Fyne to your own code are now guaranteed to occur on the "app goroutine" - ie main - so it is never needed to use fyne.Do[AndWait] in your Fyne event handlers/ callbacks.
All functions passed to fyne.Do[AndWait] are executed sequentially in the order received.