We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Congratulation to this gem of library. I would like to use it to programmatically create macOS apps with Go.
How can I make this work? The code below crashes as soon the NewNSWindow call is done. It looks like it has something to do with NSRectMake.
Thanks in advance. `
package main
import ( "github.com/mkrautz/objc" . "github.com/mkrautz/objc/Foundation" . "github.com/mkrautz/objc/AppKit" "runtime" "fmt" )
type ApplicationDelegate struct { objc.Object }
func InitApplicationDelegate() ApplicationDelegate { return ApplicationDelegate{objc.GetClass("ApplicationDelegate").Alloc().Init()} }
func main() { defer runtime.LockOSThread() pool := NewNSAutoreleasePool() defer pool.Release()
app := NSSharedApplication() del := InitApplicationDelegate() app.SetDelegate(del) app.SendMsg("setActivationPolicy:", 0) rect := NSRectMake(0, 0, 500, 500) window := NewNSWindow(rect, NSWindowStyleMaskTitled, NSBackingStoreBuffered, false) window.SendMsg("display") window.SendMsg("makeKeyAndOrderFront:", app) fmt.Println("Still OK!") app.SendMsg("activateIgnoringOtherApps:", true) app.Run() pool.Release()
}`
Not sure why the code is weirdly displayed on GitHub...
The text was updated successfully, but these errors were encountered:
To fix the code display, you need to surround it in triple backticks ```
There is an example in the repo that shows how to create a simple app delegate in go: https://github.com/mkrautz/objc/blob/master/demo/demo.go#L17-L19
Sorry, something went wrong.
No branches or pull requests
Congratulation to this gem of library.
I would like to use it to programmatically create macOS apps with Go.
How can I make this work?
The code below crashes as soon the NewNSWindow call is done.
It looks like it has something to do with NSRectMake.
Thanks in advance.
`
package main
import (
"github.com/mkrautz/objc"
. "github.com/mkrautz/objc/Foundation"
. "github.com/mkrautz/objc/AppKit"
"runtime"
"fmt"
)
type ApplicationDelegate struct {
objc.Object
}
func InitApplicationDelegate() ApplicationDelegate {
return ApplicationDelegate{objc.GetClass("ApplicationDelegate").Alloc().Init()}
}
func main() {
defer runtime.LockOSThread()
pool := NewNSAutoreleasePool()
defer pool.Release()
}`
Not sure why the code is weirdly displayed on GitHub...
The text was updated successfully, but these errors were encountered: