Wednesday, 15 January 2014

Cocoa error beep | performKeyEquivalent -



Cocoa error beep | performKeyEquivalent -

i have cocoa/swift application creates minimal web view using wkwebview (see code below).

when run app sample web page (currently www.google.com) loads correctly, if seek utilize keyup , keydown methods or seek re-create , paste text scheme error sound/ding/beep.

so have created performkeyequivalent function:

func performkeyequivalent(theevent: nsevent) -> bool { homecoming true }

but dont think have implemented correctly. i'm new xcode , swift.

see below finish code. help appreciated.

import cocoa import webkit import appkit @nsapplicationmain class appdelegate: nsobject, nsapplicationdelegate { @iboutlet weak var window: nswindow! @iboutlet weak var customview: nsview! func applicationdidfinishlaunching(anotification: nsnotification) { // insert code here initialize application var url = nsurl(string:"http://www.google.com/") var request = nsurlrequest(url:url!) var thewebview:wkwebview = wkwebview(frame: customview.bounds) customview.addsubview(thewebview) thewebview.autoresizingmask = nsautoresizingmaskoptions.viewwidthsizable | nsautoresizingmaskoptions.viewheightsizable thewebview.loadrequest(request) } func performkeyequivalent(theevent: nsevent) -> bool { homecoming true } func applicationwillterminate(anotification: nsnotification) { // insert code here tear downwards application } }

cocoa beep

No comments:

Post a Comment