[go-nuts] Re: About package lxn/walk

2019-10-14 Thread 洪嘉鴻
OK, I'll try them.
However, the "\n" I used didn't work.
outTE.AppendText("Hello World !\n")
outTE.AppendText("Nice to meet you !")
The output on the text edit shows "Hello World ! Nice to meet you !"
But when I use "\r\n", it works!
Yes, the word should be "button", not "bottom".
Thanks for your help!

HaWe於 2019年10月10日星期四 UTC+8下午4時42分35秒寫道:
>
> Don't know about the lnx package. And I didn't check your code.
> But I can answer beginner's questions:
>
> 1.  The plus sign means concatenation for strings.
> var s = "text"
> s += "\n"
> 2. fmt.Println prints to standard output, but fmt.Sprintln prints to a 
> string.
> 3. Similar answer: Use fmt.Sscanf.
>
> Ahh ... and you might like the word 'button' better than 'bottom' :-)
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c08e5880-0b37-409c-a1aa-678e07f069a1%40googlegroups.com.


[go-nuts] Re: About package lxn/walk

2019-10-14 Thread 洪嘉鴻
Hello everyone:

I've finished studying https://github.com/lxn/walk/tree/master/examples.
However, there is still a problem that I'm encountering:
Is there any examples about tree diagram with buttons for references? 
Ex: When we install software, there are multiple choices for users to 
choose, and then click "Next" buttons, until the installation is finished.

Any help is appreciated.
Thank you very much!
Max

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b2b7c005-8d0c-4153-a100-f71f8621b855%40googlegroups.com.


[go-nuts] Re: About package lxn/walk

2019-10-14 Thread 洪嘉鴻
Hello everyone:

I've finished studying https://github.com/lxn/walk/tree/master/examples.
However, there are some problems that I'm encountering:
1. I want to print the message after clicking the "Confirm" button, but I 
have no idea how to implement it. Here is the incompleted code: 
https://play.golang.org/p/ENxFtzd_FBr.
2. Is there any examples about tree diagram with buttons for references? 
(Ex: When we install software, there are multiple choices for users to 
choose, and then click "Next" buttons, until the installation is finished.)

Any help is appreciated.
Thank you very much!
Max

洪嘉鴻於 2019年10月9日星期三 UTC+8下午10時25分06秒寫道:
>
> Hello everyone:
>I'm a beginner for golang with Win10. Now I'm trying to write an 
> user interface. The version of the golang which I am using is 1.12.9. Here 
> are some problems that I'm encountering:
>
> 1. How to append text with a new line?
> 2. How to output variables as the "fmt.Println" function? (Ex:  
>  fmt.Println("The initial number is:", input)) 
> 3. How to implement text edit as the "fmt.Scanf" function?
> 4. How to implement with bottoms? (Ex: There are 3 bottoms, if the third 
> bottom is clicked, the three bottoms will disappear and then appear 4 new 
> bottoms to let the user choose.)
>
> Here is the code for the problems above, where the code is with lots of 
> errors
> Any help is appreciated.
> Thank you very much!
> Max
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b1847597-0ab8-4569-a942-16f1aa3b17c7%40googlegroups.com.


[go-nuts] question about runtime design

2019-10-14 Thread awh6al
salam. Hi gophers can any one take a look at at this snippet of code 
https://play.golang.org/p/qv0N0EN81tX 
and answer me why should this panic at runtime, and why the compiler 
does not catch this kind of mistakes.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4afcfd42-72d3-4920-9ea1-df1ae71c5b8f%40googlegroups.com.


[go-nuts] go 1.13.1 (linux x64): time.After not working as expected

2019-10-14 Thread Jeff Kayser
I'm working through the most excellent book "Concurrency in Go", doing the 
example on page 162-166.  My code is here:

https://play.golang.org/p/7kokkAIdhov

The program is not triggering the timeout section of the code (lines 
103-103 in the playground code).

All of the other examples have worked as expected, including the one just 
before this, which is almost identical, except for a couple of tweaks.  
This is the first one that hasn't worked.

What am I doing wrong?

~Jeff Kayser

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6316c901-9425-4d4f-9bb3-2f7d4aed94a5%40googlegroups.com.


Re: [go-nuts] go 1.13.1 (linux x64): time.After not working as expected

2019-10-14 Thread Steven Hartland

Your not checking done in your for loop.

On 14/10/2019 13:39, Jeff Kayser wrote:
I'm working through the most excellent book "Concurrency in Go", doing 
the example on page 162-166.  My code is here:


https://play.golang.org/p/7kokkAIdhov

The program is not triggering the timeout section of the code (lines 
103-103 in the playground code).


All of the other examples have worked as expected, including the one 
just before this, which is almost identical, except for a couple of 
tweaks.  This is the first one that hasn't worked.


What am I doing wrong?

~Jeff Kayser

--
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 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6316c901-9425-4d4f-9bb3-2f7d4aed94a5%40googlegroups.com 
.


--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/487e1ad8-e0e6-a3d7-d69b-b9a20dec9295%40multiplay.co.uk.


[go-nuts] Re: go 1.13.1 (linux x64): time.After not working as expected

2019-10-14 Thread Jeff Kayser


On Monday, October 14, 2019 at 5:53:23 AM UTC-7, Jeff Kayser wrote:
>
> I'm working through the most excellent book "Concurrency in Go", doing the 
> example on page 162-166.  My code is here:
>
> https://play.golang.org/p/7kokkAIdhov
>
> The program is not triggering the timeout section of the code (lines 
> 103-103 in the playground code).
>
> All of the other examples have worked as expected, including the one just 
> before this, which is almost identical, except for a couple of tweaks.  
> This is the first one that hasn't worked.
>
> What am I doing wrong?
>
> ~Jeff Kayser
>
>
Forgot to increment the variable "i" (the loop counter).  Doh!  My bad.  I 
found it.  Thanks for looking over my buggy code.
After I fixed that, I also discovered that, by ending the loop after two 
iterations, the goroutine ended, closed the channels, and then the main 
program detected the channel closing, rather than the timeout.  Lovely.  
As Benny Hill would say: "Learning all the time".

The book "Concurrency in Go" is absolutely fabulous, second only to The Go 
Programming Language.
We are so lucky to have all those good Go books.

Thanks again.

Jeff Kayser

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/683804bf-b6de-4ebe-a559-f167d17391e5%40googlegroups.com.


Re: [go-nuts] question about runtime design

2019-10-14 Thread Ian Lance Taylor
On Mon, Oct 14, 2019 at 5:53 AM  wrote:
>
> salam. Hi gophers can any one take a look at at this snippet of code
> https://play.golang.org/p/qv0N0EN81tX
> and answer me why should this panic at runtime, and why the compiler
> does not catch this kind of mistakes.

I assume that you are asking why in your code `call(nil)` will panic
at runtime.  That will pass `nil` as the argument to `call`, which
takes an argument of the interface type `is`.  It then tries to invoke
a method on its argument.  When called with `nil`, invoking the method
fails, because there interface is `nil` and there is no method to
call.  So the program crashes.

The compiler doesn't catch this because it's fine for the `call`
function to call a method on its argument, and it's fine to pass `nil`
as the argument to a function that takes a value of interface type.
It's only in combination that these fail.

If that answer doesn't make sense, perhaps you could be more specific.
For example, tell us exactly what code you think the compiler should
catch.

Ian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVs4pKg7HeGuyGUr4dd0iM2b459AAGQuW_PYLNP53AkBg%40mail.gmail.com.