Space Bar Event

  • This seems like it should be trivial but I can't find an elegant
    solution. I need to detect the space bar being pushed.

    I've searched the archives and other than performing !
    NSEqualRanges([[event characters] rangeOfString:@" "], (NSRange){0,
    0}) there doesn't seem to be any other way of reliably detecting it.

    There is no unicode defined for it in the NSEvent header and there is
    no NSResponder method either. There must be a better way of doing this.

    Keith
  • On Jan 2, 2008, at 12:59 PM, Keith Duncan wrote:

    > I've searched the archives and other than performing !
    > NSEqualRanges([[event characters] rangeOfString:@" "], (NSRange){0,
    > 0}) there doesn't seem to be any other way of reliably detecting it.
    >
    > There is no unicode defined for it in the NSEvent header and there
    > is no NSResponder method either. There must be a better way of doing
    > this.

    You can at least abbreviate it to:

    [[event characters] isEqualToString: @" "]

    j o a r
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today