In this last sample code, when you press a key, Cocoa triggers an audible error beep if no "keyboard gadget" has the focus.
Do you know how to avoid this ?
I have found an equivalent request on the web but how to implement the proposed solution in PB ?
http://stackoverflow.com/questions/1351 ... error-beep
EventHandler to detect key presses and mouse clicks
Re: EventHandler to detect key presses and mouse clicks
A solution to this problem is very easy: simply insert the following line behind the definition of the EditorGadget in wilbert's last code example:Niffo wrote:In this last sample code, when you press a key, Cocoa triggers an audible error beep if no "keyboard gadget" has the focus.
Do you know how to avoid this ?
Code: Select all
CocoaMessage(0, WindowID(0), "makeFirstResponder:", GadgetID(0))
Re: EventHandler to detect key presses and mouse clicks
Thank you very much, it works like a charm when there is a gadget on the window !
But do you have a solution if there is no gadget on the window ?
But do you have a solution if there is no gadget on the window ?
Last edited by Niffo on Tue Jul 08, 2014 3:11 pm, edited 2 times in total.
Niffo
Re: EventHandler to detect key presses and mouse clicks
I really would like to know it too.