I'm having five Image Buttons. If a button was clicked by mouse, then the button went to Onstate. Now if i pressed Space button it will zoom the button's image in a seperate Window. The space button should not work when the button id in OFFstate. now can i trigger the Keyevent? i already referred Quicklook and working on that. any new ideas?
Asked
Active
Viewed 516 times
1 Answers
0
You don't need to trigger the key event, just respond to it as though it were any old method call from the button. After giving it a target and a selector, give it a key equivalent of @" "
and respond to the key press accordingly:
- (void)someAction:(NSButton*)sender event:(NSEvent*)event {
//...
if ((sender.state == NSOnState) && (event.keyCode == 0x32)) {
//Zoom
}
//...
}

CodaFi
- 43,043
- 8
- 107
- 153