update ShowAlert optimize return code

This commit is contained in:
vcaesar 2020-11-05 10:57:51 -04:00
parent 4fe4fe8b22
commit 06ad6eb8a1
5 changed files with 6 additions and 6 deletions

View File

@ -311,7 +311,7 @@ func main() {
}
abool := robotgo.ShowAlert("test", "robotgo")
if abool == 0 {
if abool {
fmt.Println("ok@@@ ", "ok")
}

View File

@ -308,7 +308,7 @@ func main() {
}
abool := robotgo.ShowAlert("test", "robotgo")
if abool == 0 {
if abool {
fmt.Println("ok@@@ ", "ok")
}

View File

@ -20,7 +20,7 @@ import (
func alert() {
// show Alert Window
abool := robotgo.ShowAlert("hello", "robotgo")
if abool == 0 {
if abool {
fmt.Println("ok@@@", "ok")
}
robotgo.ShowAlert("hello", "robotgo", "Ok", "Cancel")

View File

@ -1361,7 +1361,7 @@ ____ __ ____ __ .__ __. _______ ______ ____ __ ____
*/
// ShowAlert show a alert window
func ShowAlert(title, msg string, args ...string) int {
func ShowAlert(title, msg string, args ...string) bool {
var (
// title string
// msg string
@ -1392,7 +1392,7 @@ func ShowAlert(title, msg string, args ...string) int {
C.free(unsafe.Pointer(adefaultButton))
C.free(unsafe.Pointer(acancelButton))
return ibool
return ibool == 0
}
// IsValid valid the window

View File

@ -19,7 +19,7 @@ import (
func aRobotgo() {
abool := robotgo.ShowAlert("test", "robotgo")
if abool == 0 {
if abool {
fmt.Println("ok@@@", "ok")
}