Fwd: [go-nuts] lxn/walk goroutine blocks

2016-10-11 Thread Pietro Gagliardi


> Begin forwarded message:
> 
> From: Pietro Gagliardi 
> Subject: Re: [go-nuts] lxn/walk goroutine blocks
> Date: October 11, 2016 at 7:48:04 AM EDT
> To: Tamás Gulácsi 
> 
> That would mean lxn/walk is doing initialization on the init() thread, 
> because Windows does not care which thread you use for GUI stuff, and in fact 
> lets you do GUI stuff on multiple threads at once. (You just can't *cross* 
> threads; if you call CreateWindow() on a thread, you have to use that window 
> from that same thread, and any other thread can only SendMessage() or 
> PostMessage() to it.)
>> On Oct 11, 2016, at 3:51 AM, Tamás Gulácsi  wrote:
>> 
>> I suspect that the main thread has to communicate with the gui libs. This is 
>> a common restrictio.
>> Live with it: do the other stuff in a goroutine.
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] lxn/walk goroutine blocks

2016-10-11 Thread Tamás Gulácsi
I suspect that the main thread has to communicate with the gui libs. This is a 
common restrictio.
Live with it: do the other stuff in a goroutine.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] lxn/walk goroutine blocks

2016-10-10 Thread rbirac
Hi Guys,
I’m building a GUI for my robot.  I’m using Windows, so found lxn/walk.   
Working from the examples, I built a GUI which did all that I want right 
now.  I developed it in the main() function, just like the examples; but 
for the actual robot, I want it to run in its own goroutine with the code 
in a separate package.  Well, I can’t make that work.  I can’t even get it 
to work as a goroutine in main().
The minimal example code below demonstrates the problem.  The main() 
function has two ways to start the GUI.  If I run the “Gui()” version.  The 
GUI appears on the screen as expected and the controls function.  However, 
the subsequent 5 second Sleep and Println() don’t begin to run until I 
close the GUI window by clicking the X.  If I run the “go Gui()” version, 
 The GUI does not appear on the screen, but the code does continue and 
prints after the 5 second sleep.
I expect that it is possible to do what I want (i.e.  "go Gui” with 
continuation to the sleep and Println).  I am pretty much a newbie, but I 
have written a number of relatively complex goroutines that don’t have this 
problem.
I’m running on Windows 10 (x64) with go 1.6.2 on LiteIDE X29 and a very 
recent walk download.
I’m hoping someone can point out my possible naïve error, or maybe a link 
to some code that does what I want.
Thanks,
Alex

package main


import (

"fmt"

"time"

. "github.com/lxn/walk/declarative"

)


func main() {

//Gui() //  draws operative GUI window, but blocks from continuing to Sleep 
and Println

go Gui() // doesn't draw GUI window. Continues and does Println after 5 
seconds


time.Sleep(time.Millisecond * 5000)

fmt.Println("testing")

}


func Gui() {

MainWindow{

Title:   "SCREAMO",

MinSize: Size{600, 400},

}.Run()

}


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.