lxn / walk

A Windows GUI toolkit for the Go Programming Language
Other
6.78k stars 886 forks source link

Add RunWithContext function #826

Open kukymbr opened 8 months ago

kukymbr commented 8 months ago

At the moment, there is no way to cancel the GUI's run if something went wrong in some other part of an application. I propose to add a window.RunWithContext function to pass the context.

gen2brain commented 8 months ago

@kukymbr Thanks, this is nice. I tried to avoid Run with my message loop, but that only shows an empty window, probably because I cannot call RunSynchronized on the group. With your addition, everything works for me and I can cancel the context to close the window. I hope this will be merged, for now, I am using your forked repo.