Example #1
0
func _msgBox(parent *Window, primarytext string, secondarytext string, style uintptr) chan int {
	ret := make(chan int)
	uitask <- func() {
		var pwin C.id = nil

		if parent != dialogWindow {
			pwin = parent.sysData.id
		}
		primary := toNSString(primarytext)
		secondary := C.id(nil)
		if secondarytext != "" {
			secondary = toNSString(secondarytext)
		}
		switch style {
		case 0: // normal
			C.msgBox(pwin, primary, secondary, unsafe.Pointer(&ret))
		case 1: // error
			C.msgBoxError(pwin, primary, secondary, unsafe.Pointer(&ret))
		}
	}
	return ret
}
Example #2
0
func _msgBox(parent *Window, primarytext string, secondarytext string, style uintptr) {
	ret := make(chan struct{})
	defer close(ret)
	uitask <- func() {
		var pwin C.id = nil

		if parent != nil {
			pwin = parent.sysData.id
		}
		primary := toNSString(primarytext)
		secondary := C.id(nil)
		if secondarytext != "" {
			secondary = toNSString(secondarytext)
		}
		switch style {
		case 0: // normal
			C.msgBox(pwin, primary, secondary)
		case 1: // error
			C.msgBoxError(pwin, primary, secondary)
		}
		ret <- struct{}{}
	}
	<-ret
}